Skip to content

Commit

Permalink
feat: add namespace to ServiceAccount in cluster role binding and upd…
Browse files Browse the repository at this point in the history
…ate image pull secret handling

On-behalf-of: @SAP angel.kafazov@sap.com
Signed-off-by: Angel Kafazov <akafazov@cst-bg.net>
  • Loading branch information
akafazov committed Nov 25, 2024
1 parent c2860ca commit 69ce62e
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 3 deletions.
Binary file modified charts/account-operator/charts/account-operator-crds-0.1.5.tgz
Binary file not shown.
Binary file modified charts/account-operator/charts/common-0.1.5.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions charts/account-operator/templates/cluster-rolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ include "common.entity.name" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ include "common.entity.name" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ operator match the snapshot:
subjects:
- kind: ServiceAccount
name: account-operator
namespace: NAMESPACE
4: |
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -644,6 +645,7 @@ operator match the snapshot (with kubeconfigSecret):
subjects:
- kind: ServiceAccount
name: account-operator
namespace: NAMESPACE
4: |
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -1022,6 +1024,7 @@ operator match the snapshot with webhook enabled:
subjects:
- kind: ServiceAccount
name: account-operator
namespace: NAMESPACE
4: |
apiVersion: apps/v1
kind: Deployment
Expand Down
11 changes: 9 additions & 2 deletions charts/common/templates/_deploymentHelpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ automountServiceAccountToken: {{ not (eq (.Values.security).mountServiceAccountT
{{- define "common.terminationGracePeriodSeconds" -}}
{{ .Values.terminationGracePeriodSeconds | default 10 }}
{{- end }}

{{- define "common.imagePullPolicy" -}}
{{ .Values.imagePullPolicy | default "Always" }}
{{- end }}
{{- if .Values.imagePullPolicy -}}
{{ .Values.imagePullPolicy }}
{{- else if and .Values.global (.Values.global.imagePullPolicy) -}}
{{ .Values.global.imagePullPolicy }}
{{- else -}}
Always
{{- end -}}
{{- end }}
2 changes: 1 addition & 1 deletion charts/common/templates/_imagePullSecret.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- define "common.imagePullSecret" }}
{{- if .Values.imagePullSecret }}
{{- if or .Values.imagePullSecret ((.Values).global).imagePullSecret }}
imagePullSecrets:
- name: {{ default .Values.imagePullSecret (.Values.global).imagePullSecret }}
{{- end }}
Expand Down
Binary file modified charts/extension-manager-operator/charts/common-0.1.5.tgz
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions charts/extension-manager-operator/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ rules:
- update
- patch
- delete
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ operator match the snapshot:
- update
- patch
- delete
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
2: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
10 changes: 10 additions & 0 deletions charts/extension-manager-operator/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ tests:
template: service-account.yaml
set:
imagePullSecret: my-secret
asserts:
- equal:
path: imagePullSecrets
value:
- name: my-secret
- it: configure global imagePullSecret
template: service-account.yaml
set:
global:
imagePullSecret: my-secret
asserts:
- equal:
path: imagePullSecrets
Expand Down
Binary file modified charts/portal/charts/common-0.1.5.tgz
Binary file not shown.

0 comments on commit 69ce62e

Please sign in to comment.