Skip to content

Commit

Permalink
Merge pull request #257 from falcon-pioupiou/fix-kpa-registryconfigjson
Browse files Browse the repository at this point in the history
fix(kpa): update regsecret's name when registryConfigJSON is used
  • Loading branch information
redhatrises authored Feb 6, 2024
2 parents 5610e59 + 5c1499e commit 4e76d26
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion helm-charts/cs-k8s-protection-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "1.0.1"
version: "1.0.2"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
9 changes: 5 additions & 4 deletions helm-charts/cs-k8s-protection-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ spec:
spec:
{{- if or (.Values.image.pullSecrets) (.Values.image.registryConfigJSON) (.Values.crowdstrikeConfig.dockerAPIToken) }}
imagePullSecrets:
{{ if .Values.crowdstrikeConfig.dockerAPIToken }}
{{- if and (.Values.crowdstrikeConfig.dockerAPIToken) (.Values.image.registryConfigJSON) }}
{{- fail "crowdstrikeConfig.dockerAPIToken and image.registryConfigJSON cannot be used together." }}
{{- else -}}
{{ if or (.Values.crowdstrikeConfig.dockerAPIToken) (.Values.image.registryConfigJSON) }}
- name: {{ include "cs-k8s-protection-agent.fullname" . }}-regsecret
{{- end }}
{{- end }}
{{ if .Values.image.pullSecrets }}
- name: {{ .Values.image.pullSecrets }}
{{- end }}
{{ if .Values.image.registryConfigJSON }}
- name: {{ include "cs-k8s-protection-agent.fullname" . }}-regsecret-registryconfigjson
{{- end }}
{{- end }}
serviceAccountName: {{ .Values.serviceAccount.name | default ( include "cs-k8s-protection-agent.fullname" . ) }}
securityContext:
Expand Down
18 changes: 5 additions & 13 deletions helm-charts/cs-k8s-protection-agent/templates/docker-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if .Values.crowdstrikeConfig.dockerAPIToken }}
{{ if or (.Values.crowdstrikeConfig.dockerAPIToken) (.Values.image.registryConfigJSON) }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -8,18 +8,10 @@ metadata:
{{- include "cs-k8s-protection-agent.labels" . | nindent 4 }}
type: kubernetes.io/dockerconfigjson
data:
{{- if .Values.crowdstrikeConfig.dockerAPIToken }}
.dockerconfigjson: {{ template "imagePullSecret" . }}
{{- end}}
{{- end }}
{{- if .Values.image.registryConfigJSON }}
{{- $registry := .Values.image.registryConfigJSON }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "cs-k8s-protection-agent.fullname" . }}-regsecret
namespace: {{ .Release.Namespace }}
labels:
{{- include "cs-k8s-protection-agent.labels" . | nindent 4 }}
data:
.dockerconfigjson: {{ $registry }}
type: kubernetes.io/dockerconfigjson
.dockerconfigjson: {{ .Values.image.registryConfigJSON }}
{{- end }}
{{- end}}

0 comments on commit 4e76d26

Please sign in to comment.