Skip to content

Commit b503073

Browse files
committed
Refactor Helm chart
Signed-off-by: Yi Chen <[email protected]>
1 parent 8a18cc4 commit b503073

25 files changed

+814
-765
lines changed
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
118
# Patterns to ignore when building packages.
219
# This supports shell glob matching, relative path matching, and
320
# negation (prefixed with !). Only one pattern per line.
4-
.DS_Store
21+
22+
ci/
23+
24+
# helm-unittest
25+
./tests
26+
.debug
27+
__snapshot__
28+
29+
# helm-docs
30+
README.md.gotmpl
31+
532
# Common VCS dirs
633
.git/
734
.gitignore
@@ -10,14 +37,19 @@
1037
.hg/
1138
.hgignore
1239
.svn/
40+
1341
# Common backup files
1442
*.swp
1543
*.bak
1644
*.tmp
1745
*.orig
1846
*~
47+
1948
# Various IDEs
2049
.project
2150
.idea/
2251
*.tmproj
2352
.vscode/
53+
54+
# MacOS
55+
.DS_Store

helm/flink-kubernetes-operator/Chart.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@
1616
# limitations under the License.
1717
################################################################################
1818

19-
---
2019
apiVersion: v2
20+
2121
name: flink-kubernetes-operator
22+
2223
description: A Helm chart for the Apache Flink Kubernetes Operator
24+
2325
type: application
26+
2427
version: 1.13-SNAPSHOT
28+
2529
appVersion: 1.13-SNAPSHOT
30+
31+
home: https://github.com/apache/flink-kubernetes-operator
32+
2633
icon: https://flink.apache.org/img/logo/png/50/color_50.png

helm/flink-kubernetes-operator/templates/_helpers.tpl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ Selector labels
6767
app.kubernetes.io/name: {{ include "flink-operator.name" . }}
6868
{{- end }}
6969

70-
{{/*
71-
Create the path of the operator image to use
72-
*/}}
73-
{{- define "flink-operator.imagePath" -}}
70+
{{- /* Create the name of the operator image to use. */ -}}
71+
{{- define "flink-operator.image" -}}
7472
{{- if .Values.image.digest }}
75-
{{- .Values.image.repository }}@{{ .Values.image.digest }}
73+
{{- printf "%s@%s" .Values.image.repository .Values.image.digest }}
7674
{{- else }}
77-
{{- .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}
75+
{{- printf "%s:%s" .Values.image.repository (.Values.image.tag | default .Chart.AppVersion) }}
7876
{{- end }}
7977
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- /*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/ -}}
18+
19+
{{- /* Create the name of the deployment to use. */ -}}
20+
{{- define "flink-operator.certManager.certificate.name" -}}
21+
flink-operator-serving-cert
22+
{{- end -}}
23+
24+
{{- /* Create the name of the configmap to use. */ -}}
25+
{{- define "flink-operator.certManager.issuer.name" -}}
26+
flink-operator-selfsigned-issuer
27+
{{- end -}}

helm/flink-kubernetes-operator/templates/cert-manager/certificate.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,30 @@ See the License for the specific language governing permissions and
1616
limitations under the License.
1717
*/ -}}
1818

19-
{{- if eq (include "flink-operator.webhook-enabled" .) "true" }}
2019
apiVersion: cert-manager.io/v1
2120
kind: Certificate
2221
metadata:
23-
name: flink-operator-serving-cert
22+
name: {{ include "flink-operator.certManager.certificate.name" . }}
2423
namespace: {{ .Release.Namespace }}
2524
spec:
2625
dnsNames:
27-
- flink-operator-webhook-service.{{ .Release.Namespace }}.svc
28-
- flink-operator-webhook-service.{{ .Release.Namespace }}.svc.cluster.local
26+
- {{ printf "%s.%s.svc" (include "flink-operator.webhook.service.name" .) .Release.Namespace }}
27+
- {{ printf "%s.%s.svc.cluster.local" (include "flink-operator.webhook.service.name" .) .Release.Namespace }}
2928
keystores:
3029
pkcs12:
3130
create: true
3231
passwordSecretRef:
3332
{{- if .Values.webhook.keystore.useDefaultPassword }}
34-
name: flink-operator-webhook-secret
33+
name: {{ include "flink-operator.webhook.secret.name" . }}
3534
key: password
3635
{{- else }}
3736
{{- with .Values.webhook.keystore.passwordSecretRef }}
38-
{{- toYaml . | nindent 8 }}
37+
{{- toYaml . | nindent 8 }}
3938
{{- end }}
4039
{{- end }}
4140
issuerRef:
41+
group: cert-manager.io
4242
kind: Issuer
43-
name: flink-operator-selfsigned-issuer
43+
name: {{ include "flink-operator.certManager.issuer.name" . }}
4444
commonName: FlinkDeployment Validator
4545
secretName: webhook-server-cert
46-
{{- end }}

helm/flink-kubernetes-operator/templates/cert-manager/issuer.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ See the License for the specific language governing permissions and
1616
limitations under the License.
1717
*/ -}}
1818

19-
{{- if eq (include "flink-operator.webhook-enabled" .) "true" }}
2019
apiVersion: cert-manager.io/v1
2120
kind: Issuer
2221
metadata:
23-
name: flink-operator-selfsigned-issuer
22+
name: {{ include "flink-operator.certManager.issuer.name" . }}
2423
namespace: {{ .Release.Namespace }}
2524
spec:
2625
selfSigned: {}
27-
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- /*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/ -}}
18+
19+
{{- /* Create the name of the deployment to use. */ -}}
20+
{{- define "flink-operator.deployment.name" -}}
21+
{{- include "flink-operator.name" . }}
22+
{{- end -}}
23+
24+
{{- /* Create the name of the configmap to use. */ -}}
25+
{{- define "flink-operator.configmap.name" -}}
26+
flink-operator-config
27+
{{- end -}}

helm/flink-kubernetes-operator/templates/controller/configmap.yaml

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,69 @@ regarding copyright ownership. The ASF licenses this file
66
to you under the Apache License, Version 2.0 (the
77
"License"); you may not use this file except in compliance
88
with the License. You may obtain a copy of the License at
9+
910
http://www.apache.org/licenses/LICENSE-2.0
11+
1012
Unless required by applicable law or agreed to in writing, software
1113
distributed under the License is distributed on an "AS IS" BASIS,
1214
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1315
See the License for the specific language governing permissions and
1416
limitations under the License.
1517
*/ -}}
1618

17-
{{- if .Values.defaultConfiguration.create }}
19+
{{- if .Values.defaultConfiguration.create -}}
1820
apiVersion: v1
1921
kind: ConfigMap
2022
metadata:
21-
name: flink-operator-config
23+
name: {{ include "flink-operator.configmap.name" . }}
2224
namespace: {{ .Release.Namespace }}
2325
labels:
2426
{{- include "flink-operator.labels" . | nindent 4 }}
2527
data:
2628
config.yaml: |+
27-
{{- if .Values.defaultConfiguration.append }}
28-
{{- $.Files.Get "conf/flink-conf.yaml" | nindent 4 -}}
29-
{{- end }}
30-
{{- if hasKey (.Values.defaultConfiguration) "config.yaml" }}
31-
{{- index (.Values.defaultConfiguration) "config.yaml" | nindent 4 -}}
32-
{{- end }}
33-
{{- if .Values.watchNamespaces }}
34-
kubernetes.operator.watched.namespaces: {{ join "," .Values.watchNamespaces }}
35-
{{- end }}
36-
{{- if index .Values "operatorHealth" }}
29+
30+
{{- if .Values.defaultConfiguration.append }}
31+
{{- $.Files.Get "conf/flink-conf.yaml" | nindent 4 }}
32+
{{- end }}
33+
34+
{{- get .Values.defaultConfiguration "config.yaml" | nindent 4 }}
35+
36+
{{- with .Values.watchNamespaces }}
37+
kubernetes.operator.watched.namespaces: {{ . | join "," }}
38+
{{- end }}
39+
3740
kubernetes.operator.health.probe.enabled: true
3841
kubernetes.operator.health.probe.port: {{ .Values.operatorHealth.port }}
39-
{{- end }}
42+
4043
flink-conf.yaml: |+
41-
{{- if .Values.defaultConfiguration.append }}
42-
{{- $.Files.Get "conf/flink-conf.yaml" | nindent 4 -}}
43-
{{- end }}
44-
{{- if hasKey (.Values.defaultConfiguration) "flink-conf.yaml" }}
45-
{{- index (.Values.defaultConfiguration) "flink-conf.yaml" | nindent 4 -}}
46-
{{- end }}
47-
{{- if .Values.watchNamespaces }}
48-
kubernetes.operator.watched.namespaces: {{ join "," .Values.watchNamespaces }}
49-
{{- end }}
50-
{{- if index .Values "operatorHealth" }}
44+
45+
{{- if .Values.defaultConfiguration.append }}
46+
{{- $.Files.Get "conf/flink-conf.yaml" | nindent 4 }}
47+
{{- end }}
48+
49+
{{- get .Values.defaultConfiguration "flink-conf.yaml" | nindent 4 }}
50+
51+
{{- with .Values.watchNamespaces }}
52+
kubernetes.operator.watched.namespaces: {{ . | join "," }}
53+
{{- end }}
54+
5155
kubernetes.operator.health.probe.enabled: true
5256
kubernetes.operator.health.probe.port: {{ .Values.operatorHealth.port }}
53-
{{- end }}
57+
5458
log4j-operator.properties: |+
55-
{{- if .Values.defaultConfiguration.append }}
56-
{{- $.Files.Get "conf/log4j-operator.properties" | nindent 4 -}}
57-
{{- end }}
58-
{{- if index (.Values.defaultConfiguration) "log4j-operator.properties" }}
59-
{{- index (.Values.defaultConfiguration) "log4j-operator.properties" | nindent 4 -}}
60-
{{- end }}
59+
60+
{{- if .Values.defaultConfiguration.append }}
61+
{{- $.Files.Get "conf/log4j-operator.properties" | nindent 4 }}
62+
{{- end }}
63+
64+
{{- get .Values.defaultConfiguration "log4j-operator.properties" | nindent 4 }}
65+
6166
log4j-console.properties: |+
62-
{{- if .Values.defaultConfiguration.append }}
63-
{{- $.Files.Get "conf/log4j-console.properties" | nindent 4 -}}
64-
{{- end }}
65-
{{- if index (.Values.defaultConfiguration) "log4j-console.properties" }}
66-
{{- index (.Values.defaultConfiguration) "log4j-console.properties" | nindent 4 -}}
67-
{{- end }}
67+
68+
{{- if .Values.defaultConfiguration.append }}
69+
{{- $.Files.Get "conf/log4j-console.properties" | nindent 4 }}
70+
{{- end }}
71+
72+
{{- get .Values.defaultConfiguration "log4j-console.properties" | nindent 4 }}
73+
6874
{{- end }}

0 commit comments

Comments
 (0)