-
Notifications
You must be signed in to change notification settings - Fork 406
/
deployment.yaml
140 lines (140 loc) · 9.42 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "fullname" . }}-ctrl-mngr
namespace: {{ .Release.Namespace }}
labels:
kyma-project.io/component: controller
{{- include "tplValue" ( dict "value" .Values.global.commonLabels "context" . ) | nindent 4 }}
{{- if .Values.deployment.labels }}
{{- include "tplValue" ( dict "value" .Values.deployment.labels "context" . ) | nindent 4 }}
{{- end }}
{{- if .Values.deployment.annotations }}
annotations:
{{ include "tplValue" ( dict "value" .Values.deployment.annotations "context" . ) | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: {{ template "name" . }}
app.kubernetes.io/name: {{ template "name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
replicas: {{ .Values.deployment.replicas }}
{{- if .Values.deployment.extraProperties }}
{{ include "tplValue" ( dict "value" .Values.deployment.extraProperties "context" . ) | nindent 2 }}
{{- end }}
template:
metadata:
labels:
app: {{ template "name" . }}
app.kubernetes.io/name: {{ template "name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
kyma-project.io/component: controller
{{- if .Values.pod.labels }}
{{ include "tplValue" ( dict "value" .Values.pod.labels "context" . ) | nindent 8 }}
{{- end }}
{{- if or .Values.pod.annotations (and .Values.metrics.enabled .Values.metrics.pod.annotations) }}
annotations:
{{- if .Values.pod.annotations }}
{{ include "tplValue" ( dict "value" .Values.pod.annotations "context" . ) | nindent 8 }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.pod.annotations }}
{{ include "tplValue" ( dict "value" .Values.metrics.pod.annotations "context" . ) | nindent 8 }}
{{- end }}
{{- end }}
spec:
volumes:
- name: configuration
configMap:
name: "{{ .Values.global.configuration.configmapName }}"
- name: tmpdir # Needed to allow git repo fetching with read-only rootfs enabled
emptyDir: {}
serviceAccountName: {{ template "fullname" . }}-controller-manager
{{- if .Values.pod.extraProperties }}
{{ include "tplValue" ( dict "value" .Values.pod.extraProperties "context" . ) | nindent 6 }}
{{- end }}
containers:
- name: manager
volumeMounts:
- name: configuration
mountPath: {{ .Values.global.configuration.targetDir }}
- name: tmpdir # Needed to allow git repo fetching with read-only rootfs enabled
mountPath: "/tmp"
image: "{{ include "imageurl" (dict "reg" .Values.global.containerRegistry "img" .Values.global.images.function_controller) }}"
imagePullPolicy: {{ .Values.images.function_controller.pullPolicy }}
command:
- /app/manager
{{- if .Values.containers.manager.resources }}
resources:
{{- include "tplValue" ( dict "value" .Values.containers.manager.resources "context" . ) | nindent 12 }}
{{- end }}
{{- if .Values.containers.manager.containerSecurityContext }}
securityContext:
{{- include "tplValue" ( dict "value" .Values.containers.manager.containerSecurityContext "context" . ) | nindent 12 }}
{{- end }}
ports:
- containerPort: {{ .Values.services.manager.https.targetPort }}
name: "webhook"
protocol: TCP
{{- if .Values.metrics.enabled }}
- containerPort: {{ .Values.metrics.manager.port.port }}
name: {{ .Values.metrics.manager.port.name }}
protocol: {{ .Values.metrics.manager.port.protocol }}
{{- end }}
- containerPort: {{ .Values.containers.manager.healthz.port }}
name: "health"
protocol: TCP
livenessProbe:
httpGet:
port: {{ .Values.containers.manager.healthz.port }}
path: "/healthz/"
initialDelaySeconds: {{ .Values.deployment.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.deployment.livenessProbe.timeoutSeconds }}
periodSeconds: {{.Values.deployment.livenessProbe.periodSeconds }}
failureThreshold: {{.Values.deployment.livenessProbe.failureThreshold }}
successThreshold: {{.Values.deployment.livenessProbe.successThreshold }}
readinessProbe:
httpGet:
port: {{ .Values.containers.manager.healthz.port }}
path: "/readyz/"
initialDelaySeconds: {{ .Values.deployment.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.deployment.readinessProbe.timeoutSeconds }}
periodSeconds: {{.Values.deployment.readinessProbe.periodSeconds }}
failureThreshold: {{.Values.deployment.readinessProbe.failureThreshold }}
successThreshold: {{.Values.deployment.readinessProbe.successThreshold }}
env:
{{- if .Values.metrics.enabled }}
- name: APP_METRICS_ADDRESS
value: ":{{ .Values.metrics.manager.port.port }}"
{{- end }}
{{- if gt (int .Values.deployment.replicas) 1 }}
- name: APP_LEADER_ELECTION_ENABLED
value: "true"
{{- end }}
- name: APP_HEALTHZ_ADDRESS
value: ":{{ .Values.containers.manager.healthz.port }}"
{{ include "createEnv" ( dict "name" "APP_KUBERNETES_BASE_NAMESPACE" "value" .Values.containers.manager.envs.baseNamespace "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_KUBERNETES_CONFIG_MAP_REQUEUE_DURATION" "value" .Values.containers.manager.envs.configMapRequeueDuration "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_KUBERNETES_SECRET_REQUEUE_DURATION" "value" .Values.containers.manager.envs.secretRequeueDuration "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_KUBERNETES_SERVICE_ACCOUNT_REQUEUE_DURATION" "value" .Values.containers.manager.envs.serviceAccountRequeueDuration "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_KUBERNETES_EXCLUDED_NAMESPACES" "value" .Values.containers.manager.envs.namespaceExcludedNames "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_TRACE_COLLECTOR_ENDPOINT" "value" .Values.containers.manager.envs.functionTraceCollectorEndpoint "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_PUBLISHER_PROXY_ADDRESS" "value" .Values.containers.manager.envs.functionPublisherProxyAddress "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_IMAGE_REGISTRY_DEFAULT_DOCKER_CONFIG_SECRET_NAME" "value" .Values.containers.manager.envs.imageRegistryDefaultDockerConfigSecretName "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_IMAGE_REGISTRY_EXTERNAL_DOCKER_CONFIG_SECRET_NAME" "value" .Values.containers.manager.envs.imageRegistryExternalDockerConfigSecretName "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_PACKAGE_REGISTRY_CONFIG_SECRET_NAME" "value" .Values.containers.manager.envs.packageRegistryConfigSecretName "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_IMAGE_PULL_ACCOUNT_NAME" "value" .Values.containers.manager.envs.imagePullAccountName "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_REQUEUE_DURATION" "value" .Values.containers.manager.envs.functionRequeueDuration "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_BUILD_EXECUTOR_ARGS" "value" .Values.containers.manager.envs.functionBuildExecutorArgs "context" . ) | nindent 12 }}
{{ $kaniko_executor_image := include "imageurl" (dict "reg" .Values.global.containerRegistry "img" .Values.global.images.kaniko_executor) }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_BUILD_EXECUTOR_IMAGE" "value" (dict "value" $kaniko_executor_image) "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_TARGET_CPU_UTILIZATION_PERCENTAGE" "value" .Values.containers.manager.envs.targetCPUUtilizationPercentage "context" . ) | nindent 12 }}
{{ $function_build_init_image := include "imageurl" (dict "reg" .Values.global.containerRegistry "img" .Values.global.images.function_build_init) }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_BUILD_REPO_FETCHER_IMAGE" "value" (dict "value" $function_build_init_image) "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_FUNCTION_BUILD_MAX_SIMULTANEOUS_JOBS" "value" .Values.containers.manager.envs.functionBuildMaxSimultaneousJobs "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_HEALTHZ_LIVENESS_TIMEOUT" "value" .Values.containers.manager.envs.healthzLivenessTimeout "context" . ) | nindent 12 }}
{{ include "createEnv" ( dict "name" "APP_CONFIG_PATH" "value" .Values.containers.manager.envs.configPath "context" . ) | nindent 12 }}
{{- if .Values.containers.manager.extraProperties }}
{{ include "tplValue" ( dict "value" .Values.containers.manager.extraProperties "context" . ) | nindent 10 }}
{{- end }}
priorityClassName: {{ .Values.global.serverlessPriorityClassName }}