Skip to content

Commit 5cfe8f3

Browse files
Address review: move kubectl under cleaner, remove global additions
Signed-off-by: Md. Istiak <mdistiak@appscode.com>
1 parent 79412a3 commit 5cfe8f3

4 files changed

Lines changed: 10 additions & 69 deletions

File tree

charts/service-gateway/templates/_helpers.tpl

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -81,36 +81,3 @@ Returns if ubi images are to be used
8181
{{- define "operator.ubi" -}}
8282
{{ ternary "-ubi" "" (list "operator" "all" | has (default (dig "ubi" "" (default dict .Values.distro)) .Values.global.distro.ubi)) }}
8383
{{- end }}
84-
85-
{{/*
86-
Create the name of the service account to use
87-
*/}}
88-
{{- define "appscode.serviceAccountName" -}}
89-
{{- if .Values.global.serviceAccount.create }}
90-
{{- default (include "service-gateway.fullname" .) .Values.global.serviceAccount.name }}
91-
{{- else if .Values.serviceAccount }}
92-
{{- default "default" .Values.serviceAccount.name }}
93-
{{- else }}
94-
{{- "default" }}
95-
{{- end }}
96-
{{- end }}
97-
98-
{{/*
99-
Returns the registry used for kubectl docker image
100-
*/}}
101-
{{- define "kubectl.registry" -}}
102-
{{- list .Values.global.registryFQDN (default .Values.kubectl.registry .Values.global.registry) | compact | join "/" }}
103-
{{- end }}
104-
105-
{{/*
106-
Returns the appscode image pull secrets
107-
*/}}
108-
{{- define "appscode.imagePullSecrets" -}}
109-
{{- with .Values.global.imagePullSecrets -}}
110-
imagePullSecrets:
111-
{{- toYaml . | nindent 2 }}
112-
{{- else -}}
113-
imagePullSecrets:
114-
{{- toYaml $.Values.imagePullSecrets | nindent 2 }}
115-
{{- end }}
116-
{{- end }}

charts/service-gateway/templates/cleaner/job.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,8 @@ spec:
1212
backoffLimit: 3
1313
template:
1414
spec:
15-
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
1615
serviceAccountName: {{ include "service-gateway.fullname" . }}-gwclass-cleaner
1716
automountServiceAccountToken: true
18-
{{- if eq "true" ( include "distro.openshift" . ) }}
19-
securityContext:
20-
{{- toYaml (omit .Values.cleaner.podSecurityContext "runAsUser" "runAsGroup" "fsGroup" "supplementalGroups") | nindent 8 }}
21-
{{- else }}
22-
securityContext:
23-
{{- toYaml .Values.cleaner.podSecurityContext | nindent 8 }}
24-
{{- end }}
2517
containers:
2618
- name: kubectl
2719
{{- if eq "true" ( include "distro.openshift" . ) }}
@@ -31,8 +23,8 @@ spec:
3123
securityContext:
3224
{{- toYaml .Values.cleaner.securityContext | nindent 12 }}
3325
{{- end }}
34-
image: "{{ include "kubectl.registry" . }}/{{ .Values.kubectl.repository }}:{{ .Values.kubectl.tag }}"
35-
imagePullPolicy: {{ .Values.kubectl.pullPolicy }}
26+
image: "{{ .Values.cleaner.kubectl.registry }}/{{ .Values.cleaner.kubectl.repository }}:{{ .Values.cleaner.kubectl.tag }}"
27+
imagePullPolicy: {{ .Values.cleaner.kubectl.pullPolicy }}
3628
command:
3729
- /bin/sh
3830
- -c
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and .Values.cleaner.enabled .Values.global.serviceAccount.create -}}
1+
{{- if .Values.cleaner.enabled -}}
22
apiVersion: v1
33
kind: ServiceAccount
44
metadata:
@@ -7,5 +7,5 @@ metadata:
77
annotations:
88
"helm.sh/hook-weight": "-5"
99
"helm.sh/hook": post-delete
10-
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-succeeded
10+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
1111
{{- end }}

charts/service-gateway/values.yaml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@ global:
1414
# Set operator or all to use ubi images
1515
ubi: ""
1616

17-
# Docker registry used to pull app related images
18-
registry: ""
19-
registryFQDN: ghcr.io
20-
imagePullSecrets: []
21-
22-
serviceAccount:
23-
create: true
24-
annotations: {}
25-
# The name of the service account to use.
26-
# If not set and create is true, a name is generated using the fullname template
27-
name: ""
28-
2917
clusterMetadata:
3018
uid: tbd
3119
name: tbd
@@ -157,22 +145,16 @@ vaultServer:
157145
# Vault server namespace that exist on cluster
158146
namespace: "ace"
159147

160-
kubectl:
161-
registry: appscode
162-
repository: kubectl-nonroot
163-
tag: "1.34"
164-
pullPolicy: IfNotPresent
165-
166-
# Pre-delete hook that strips the GatewayClass finalizer so the chart uninstalls cleanly.
148+
# Post-delete hook that strips the GatewayClass finalizer so the chart uninstalls cleanly.
167149
# Disabled by default. Enable when the envoy-gateway controller is deployed as a sub-chart
168150
# and shuts down before it can remove the finalizer.
169151
cleaner:
170152
enabled: false
171-
podSecurityContext:
172-
runAsNonRoot: true
173-
runAsUser: 65534
174-
seccompProfile:
175-
type: RuntimeDefault
153+
kubectl:
154+
registry: ghcr.io/appscode
155+
repository: kubectl-nonroot
156+
tag: "1.34"
157+
pullPolicy: IfNotPresent
176158
securityContext:
177159
allowPrivilegeEscalation: false
178160
capabilities:

0 commit comments

Comments
 (0)