feat: add initial support for keda authentication
This commit is contained in:
1 parent
8add9b4b13
commit
4ddd341184
6 files changed
+97
-17
No files matched your search
@@ -404,6 +404,18 @@ func getAnnotations(appName string, processType string) (ProcessAnnotations, err
|
|||||||
}
|
}
|
||||||
annotations.KedaScalingObjectAnnotations = kedaScalingObjectAnnotations
|
annotations.KedaScalingObjectAnnotations = kedaScalingObjectAnnotations
|
||||||
|
|
||||||
|
kedaSecretAnnotations, err := getAnnotation(appName, processType, "keda_secret")
|
||||||
|
if err != nil {
|
||||||
|
return annotations, err
|
||||||
|
}
|
||||||
|
annotations.KedaSecretAnnotations = kedaSecretAnnotations
|
||||||
|
|
||||||
|
kedaTriggerAuthenticationAnnotations, err := getAnnotation(appName, processType, "keda_trigger_authentication")
|
||||||
|
if err != nil {
|
||||||
|
return annotations, err
|
||||||
|
}
|
||||||
|
annotations.KedaTriggerAuthenticationAnnotations = kedaTriggerAuthenticationAnnotations
|
||||||
|
|
||||||
podAnnotations, err := getAnnotation(appName, processType, "pod")
|
podAnnotations, err := getAnnotation(appName, processType, "pod")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return annotations, err
|
return annotations, err
|
||||||
|
|||||||
@@ -70,18 +70,20 @@ type ProcessValues struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProcessAnnotations struct {
|
type ProcessAnnotations struct {
|
||||||
CertificateAnnotations map[string]string `yaml:"certificate,omitempty"`
|
CertificateAnnotations map[string]string `yaml:"certificate,omitempty"`
|
||||||
CronJobAnnotations map[string]string `yaml:"cronjob,omitempty"`
|
CronJobAnnotations map[string]string `yaml:"cronjob,omitempty"`
|
||||||
DeploymentAnnotations map[string]string `yaml:"deployment,omitempty"`
|
DeploymentAnnotations map[string]string `yaml:"deployment,omitempty"`
|
||||||
IngressAnnotations map[string]string `yaml:"ingress,omitempty"`
|
IngressAnnotations map[string]string `yaml:"ingress,omitempty"`
|
||||||
JobAnnotations map[string]string `yaml:"job,omitempty"`
|
JobAnnotations map[string]string `yaml:"job,omitempty"`
|
||||||
KedaScalingObjectAnnotations map[string]string `yaml:"keda_scaled_object,omitempty"`
|
KedaScalingObjectAnnotations map[string]string `yaml:"keda_scaled_object,omitempty"`
|
||||||
PodAnnotations map[string]string `yaml:"pod,omitempty"`
|
KedaSecretAnnotations map[string]string `yaml:"keda_secret,omitempty"`
|
||||||
SecretAnnotations map[string]string `yaml:"secret,omitempty"`
|
KedaTriggerAuthenticationAnnotations map[string]string `yaml:"keda_trigger_authentication,omitempty"`
|
||||||
ServiceAccountAnnotations map[string]string `yaml:"serviceaccount,omitempty"`
|
PodAnnotations map[string]string `yaml:"pod,omitempty"`
|
||||||
ServiceAnnotations map[string]string `yaml:"service,omitempty"`
|
SecretAnnotations map[string]string `yaml:"secret,omitempty"`
|
||||||
TraefikIngressRouteAnnotations map[string]string `yaml:"traefik_ingressroute,omitempty"`
|
ServiceAccountAnnotations map[string]string `yaml:"serviceaccount,omitempty"`
|
||||||
TraefikMiddlewareAnnotations map[string]string `yaml:"traefik_middleware,omitempty"`
|
ServiceAnnotations map[string]string `yaml:"service,omitempty"`
|
||||||
|
TraefikIngressRouteAnnotations map[string]string `yaml:"traefik_ingressroute,omitempty"`
|
||||||
|
TraefikMiddlewareAnnotations map[string]string `yaml:"traefik_middleware,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessAutoscaling contains the autoscaling configuration for a process
|
// ProcessAutoscaling contains the autoscaling configuration for a process
|
||||||
|
|||||||
+4
-4
@@ -7,9 +7,7 @@ kind: ScaledObject
|
|||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
|
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
|
||||||
dokku.com/builder-type: {{ $.Values.global.image.type }}
|
|
||||||
dokku.com/managed: "true"
|
dokku.com/managed: "true"
|
||||||
kubectl.kubernetes.io/default-container: {{ $.Values.global.app_name }}-{{ $processName }}
|
|
||||||
{{- if and $.Values.global.annotations $.Values.global.annotations.keda_scaled_object }}
|
{{- if and $.Values.global.annotations $.Values.global.annotations.keda_scaled_object }}
|
||||||
{{- range $k, $v := $.Values.global.annotations.keda_scaled_object }}
|
{{- range $k, $v := $.Values.global.annotations.keda_scaled_object }}
|
||||||
{{ $k }}: {{ $v | quote }}
|
{{ $k }}: {{ $v | quote }}
|
||||||
@@ -21,7 +19,7 @@ metadata:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}-scaled-object
|
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $processName }}
|
||||||
app.kubernetes.io/name: {{ $processName }}
|
app.kubernetes.io/name: {{ $processName }}
|
||||||
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
|
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
|
||||||
name: {{ $.Values.global.app_name}}-{{ $processName }}
|
name: {{ $.Values.global.app_name}}-{{ $processName }}
|
||||||
@@ -40,6 +38,8 @@ spec:
|
|||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
replicas: {{ $config.replicas }}
|
replicas: {{ $config.replicas }}
|
||||||
triggers:
|
triggers:
|
||||||
{{- toYaml $config.autoscaling.triggers | nindent 4 }}
|
{{- with $config.autoscaling.triggers }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{{- if .Capabilities.APIVersions.Has "keda.sh/v1alpha1" -}}
|
||||||
|
{{- range $type, $config := .Values.global.keda.auth }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
|
||||||
|
dokku.com/managed: "true"
|
||||||
|
{{- if and $.Values.global.annotations $.Values.global.annotations.keda_secret }}
|
||||||
|
{{- range $k, $v := $.Values.global.annotations.keda_secret }}
|
||||||
|
{{ $k }}: {{ $v | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and $config.annotations $config.annotations.keda_secret }}
|
||||||
|
{{- range $k, $v := $config.annotations.keda_secret }}
|
||||||
|
{{ $k }}: {{ $v | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-trigger-auth-secret
|
||||||
|
app.kubernetes.io/name: {{ $type }}
|
||||||
|
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
|
||||||
|
name: app-auth-{{ $type }}
|
||||||
|
namespace: {{ $.Values.global.namespace }}
|
||||||
|
data:
|
||||||
|
{{- with $config.secrets }}
|
||||||
|
data:
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{{- if .Capabilities.APIVersions.Has "keda.sh/v1alpha1" -}}
|
||||||
|
{{- range $type, $config := .Values.global.keda.auth }}
|
||||||
|
---
|
||||||
|
apiVersion: keda.sh/v1alpha1
|
||||||
|
kind: TriggerAuthentication
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
app.kubernetes.io/version: {{ $.Values.global.deploment_id | quote }}
|
||||||
|
dokku.com/managed: "true"
|
||||||
|
{{- if and $.Values.global.annotations $.Values.global.annotations.keda_trigger_authentication }}
|
||||||
|
{{- range $k, $v := $.Values.global.annotations.keda_trigger_authentication }}
|
||||||
|
{{ $k }}: {{ $v | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if and $config.annotations $config.annotations.keda_trigger_authentication }}
|
||||||
|
{{- range $k, $v := $config.annotations.keda_trigger_authentication }}
|
||||||
|
{{ $k }}: {{ $v | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: {{ $.Values.global.app_name }}-{{ $type }}
|
||||||
|
app.kubernetes.io/name: {{ $type }}
|
||||||
|
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
|
||||||
|
name: {{ $.Values.global.app_name }}-{{ $type }}
|
||||||
|
namespace: {{ $.Values.global.namespace }}
|
||||||
|
spec:
|
||||||
|
secretTargetRef:
|
||||||
|
{{- range $key := $config.secrets }}
|
||||||
|
- parameter: {{ $key }}
|
||||||
|
name: app-auth-{{ $type }}
|
||||||
|
key: {{ $key }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -399,7 +399,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
|||||||
|
|
||||||
values.Processes[processType] = processValues
|
values.Processes[processType] = processValues
|
||||||
|
|
||||||
templateFiles := []string{"deployment", "scaled-object"}
|
templateFiles := []string{"deployment", "keda-scaled-object"}
|
||||||
if processType == "web" {
|
if processType == "web" {
|
||||||
templateFiles = append(templateFiles, "service", "certificate", "ingress", "ingress-route", "https-redirect-middleware")
|
templateFiles = append(templateFiles, "service", "certificate", "ingress", "ingress-route", "https-redirect-middleware")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user