Skip to content

Commit 13ce79e

Browse files
authored
Merge pull request #47 from ttsuuubasa/helm-env-vars
feat(helm): support environment variable configuration in Helm chart
2 parents 3ed490d + 1e7e90c commit 13ce79e

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

charts/karpenter/templates/deployment.yaml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,68 @@ spec:
4040
{{- end }}
4141
ports:
4242
- name: http-metrics
43-
containerPort: 8080
43+
containerPort: {{ .Values.metricsPort.port }}
4444
protocol: TCP
45+
- name: http-health
46+
containerPort: {{ .Values.healthProbePort.port }}
47+
protocol: TCP
48+
env:
49+
{{- with .Values.env.batchIdleDuration }}
50+
- name: BATCH_IDLE_DURATION
51+
value: "{{ . }}"
52+
{{- end }}
53+
{{- with .Values.env.batchMaxDuration }}
54+
- name: BATCH_MAX_DURATION
55+
value: "{{ . }}"
56+
{{- end }}
57+
{{- with .Values.env.clusterAPICertificateAuthorityData }}
58+
- name: CLUSTER_API_CERTIFICATE_AUTHORITY_DATA
59+
value: "{{ . }}"
60+
{{- end }}
61+
{{- with .Values.env.clusterAPIKubeconfig }}
62+
- name: CLUSTER_API_KUBECONFIG
63+
value: "{{ . }}"
64+
{{- end }}
65+
{{- with .Values.env.clusterAPISkipTLSVerify }}
66+
- name: CLUSTER_API_SKIP_TLS_VERIFY
67+
value: "{{ . }}"
68+
{{- end }}
69+
{{- with .Values.env.clusterAPIToken }}
70+
- name: CLUSTER_API_TOKEN
71+
value: "{{ . }}"
72+
{{- end }}
73+
{{- with .Values.env.clusterAPIURL }}
74+
- name: CLUSTER_API_URL
75+
value: "{{ . }}"
76+
{{- end }}
77+
- name: HEALTH_PROBE_PORT
78+
value: "{{ .Values.healthProbePort.port }}"
79+
{{- with .Values.env.karpenterService }}
80+
- name: KARPENTER_SERVICE
81+
value: "{{ . }}"
82+
{{- end }}
83+
{{- with .Values.logLevel }}
84+
- name: LOG_LEVEL
85+
value: "{{ . }}"
86+
{{- end }}
87+
{{- with .Values.logOutputPaths }}
88+
- name: LOG_OUTPUT_PATHS
89+
value: "{{ join "," . }}"
90+
{{- end }}
91+
{{- with .Values.logErrorOutputPaths }}
92+
- name: LOG_ERROR_OUTPUT_PATHS
93+
value: "{{ join "," . }}"
94+
{{- end }}
95+
{{- with .Values.env.memoryLimit }}
96+
- name: MEMORY_LIMIT
97+
value: "{{ . }}"
98+
{{- end }}
99+
- name: METRICS_PORT
100+
value: "{{ .Values.metricsPort.port }}"
101+
{{- with .Values.env.preferencePolicy}}
102+
- name: PREFERENCE_POLICY
103+
value: "{{ . }}"
104+
{{- end }}
45105
{{- with .Values.nodeSelector }}
46106
nodeSelector:
47107
{{- toYaml . | nindent 8 }}

charts/karpenter/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ securityContext:
2121
# -- Resources for the controller container
2222
resources: { }
2323

24+
# -- Port for the health probe
25+
healthProbePort:
26+
port: 8081
27+
# -- Port for the metrics endpoint
28+
metricsPort:
29+
port: 8080
30+
31+
# -- Environment variables for the controller container
32+
env: { }
33+
34+
# -- Log level for the controller, default is "info"
35+
logLevel: info
36+
# -- Log output paths for the controller, default is "stdout"
37+
logOutputPaths:
38+
- stdout
39+
# -- Log error output paths for the controller, default is "stderr"
40+
logErrorOutputPaths:
41+
- stderr
42+
2443
# -- Node selectors to schedule the pod to nodes with labels
2544
nodeSelector: { }
2645

0 commit comments

Comments
 (0)