From 42331a44e3ebe600eff10bfd6662a1367f858fd8 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 13:57:09 +0300 Subject: [PATCH 1/9] feat(gitops-operator): add debug flag --- .../gitops-operator/_default_values.tpl | 10 +++++++++- .../_components/gitops-operator/_deployment.yaml | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl index dd552eb82..5647e9322 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl @@ -79,7 +79,8 @@ securityContext: capabilities: drop: - "ALL" -command: [] +command: + - /manager extraArgs: [] nodeSelector: {} tolerations: [] @@ -87,6 +88,13 @@ extraVolumes: [] extraVolumeMounts: [] affinity: {} +debug: + enabled: true + image: + registry: registry.k8s.io + repository: pause + tag: 3.10 + resources: limits: {} requests: diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index 0e59fc068..c6bcc248b 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -33,8 +33,13 @@ spec: {{- end }} serviceAccountName: {{ include "gitops-operator.serviceAccountName" . }} securityContext: + {{- if .Values.debug.enabled }} + runAsNonRoot: false + {{- else }} {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- end }} containers: + {{- if not .Values.debug.enabled }} - name: manager securityContext: {{- toYaml .Values.securityContext | nindent 12 }} @@ -45,12 +50,9 @@ spec: image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" $imageContext "context" .) }} env: {{- include "codefresh-gitops-runtime.env-vars" (dict "Values" $mergedValues "context" .) | nindent 8 }} imagePullPolicy: {{ .Values.image.pullPolicy }} - {{- if .Values.command }} command: + {{- if .Values.command }} {{- .Values.command | toYaml | nindent 8 }} - {{- else }} - command: - - /manager {{- end }} {{- with .Values.extraArgs }} args: @@ -89,6 +91,12 @@ spec: {{- with .Values.extraVolumeMounts }} {{- toYaml . | nindent 8 }} {{- end }} + {{- end }} + {{- if .Values.debug.enabled }} + - name: debug + {{- $imageContext := deepCopy .Values.debug.image }} + image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" $imageContext "context" .) }} + {{- end }} {{- with .Values.nodeSelector | default .Values.global.nodeSelector }} nodeSelector: {{ toYaml . | nindent 8 }} {{- end }} From 10e0ad459ac0572df6866b20f4d51506f5666b2e Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 13:57:22 +0300 Subject: [PATCH 2/9] feat(gitops-operator): add debug flag --- .../templates/_components/gitops-operator/_default_values.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl index 5647e9322..15566caea 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl @@ -89,7 +89,7 @@ extraVolumeMounts: [] affinity: {} debug: - enabled: true + enabled: false image: registry: registry.k8s.io repository: pause From 015e296fe54d3e3f681a39975eb7af6002e46245 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 14:09:58 +0300 Subject: [PATCH 3/9] feat(gitops-operator): add debug flag --- .../_components/gitops-operator/_deployment.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index c6bcc248b..d27248aaf 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -39,11 +39,14 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- end }} containers: - {{- if not .Values.debug.enabled }} - name: manager securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - {{- $imageContext := deepCopy .Values.image }} + {{- if .Values.debug.enabled }} + {{- $imageContext := deepCopy .Values.debug.image }} + {{- else }} + {{- $imageContext := deepCopy .Values.image }} + {{- end }} {{- if not (get $imageContext "tag") }} {{- $_ := set $imageContext "tag" .Chart.AppVersion }} {{- end }} @@ -91,12 +94,6 @@ spec: {{- with .Values.extraVolumeMounts }} {{- toYaml . | nindent 8 }} {{- end }} - {{- end }} - {{- if .Values.debug.enabled }} - - name: debug - {{- $imageContext := deepCopy .Values.debug.image }} - image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" $imageContext "context" .) }} - {{- end }} {{- with .Values.nodeSelector | default .Values.global.nodeSelector }} nodeSelector: {{ toYaml . | nindent 8 }} {{- end }} From da6172af9233ab3889d5ed69e38dd8b253a43f85 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 14:10:25 +0300 Subject: [PATCH 4/9] feat(gitops-operator): add debug flag --- .../templates/_components/gitops-operator/_deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index d27248aaf..c29e1d249 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -39,7 +39,7 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- end }} containers: - - name: manager + - name: {{ ternary .Values.debug.enabled "debug" "manager" }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} {{- if .Values.debug.enabled }} From 3bc30bff5467ae2aae2eee5acec1a32c0c719a22 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 14:12:20 +0300 Subject: [PATCH 5/9] feat(gitops-operator): add debug flag --- .../_components/gitops-operator/_default_values.tpl | 2 +- .../templates/_components/gitops-operator/_deployment.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl index 15566caea..5647e9322 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl @@ -89,7 +89,7 @@ extraVolumeMounts: [] affinity: {} debug: - enabled: false + enabled: true image: registry: registry.k8s.io repository: pause diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index c29e1d249..fe9a20213 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -46,9 +46,9 @@ spec: {{- $imageContext := deepCopy .Values.debug.image }} {{- else }} {{- $imageContext := deepCopy .Values.image }} - {{- end }} - {{- if not (get $imageContext "tag") }} - {{- $_ := set $imageContext "tag" .Chart.AppVersion }} + {{- if not (get $imageContext "tag") }} + {{- $_ := set $imageContext "tag" .Chart.AppVersion }} + {{- end }} {{- end }} image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" $imageContext "context" .) }} env: {{- include "codefresh-gitops-runtime.env-vars" (dict "Values" $mergedValues "context" .) | nindent 8 }} From aa43d3fe54d4a842a91b3e1682deb68cee8b0ceb Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 14:14:19 +0300 Subject: [PATCH 6/9] feat(gitops-operator): add debug flag --- .../_components/gitops-operator/_deployment.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index fe9a20213..abbee007b 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -39,16 +39,15 @@ spec: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- end }} containers: - - name: {{ ternary .Values.debug.enabled "debug" "manager" }} + - name: {{ ternary "debug" "manager" .Values.debug.enabled }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} + {{- $imageContext := deepCopy .Values.image }} + {{- if not (get $imageContext "tag") }} + {{- $_ := set $imageContext "tag" .Chart.AppVersion }} + {{- end }} {{- if .Values.debug.enabled }} - {{- $imageContext := deepCopy .Values.debug.image }} - {{- else }} - {{- $imageContext := deepCopy .Values.image }} - {{- if not (get $imageContext "tag") }} - {{- $_ := set $imageContext "tag" .Chart.AppVersion }} - {{- end }} + {{- $imageContext = deepCopy .Values.debug.image }} {{- end }} image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" $imageContext "context" .) }} env: {{- include "codefresh-gitops-runtime.env-vars" (dict "Values" $mergedValues "context" .) | nindent 8 }} From 72f82292ba27907cfc1625f5f6cee9353bfeb5c7 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 14:16:27 +0300 Subject: [PATCH 7/9] feat(gitops-operator): add debug flag --- .../templates/_components/gitops-operator/_default_values.tpl | 3 +-- .../templates/_components/gitops-operator/_deployment.yaml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl index 5647e9322..18df315d6 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl @@ -79,8 +79,7 @@ securityContext: capabilities: drop: - "ALL" -command: - - /manager +command: [] extraArgs: [] nodeSelector: {} tolerations: [] diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index abbee007b..afb3e632d 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -52,9 +52,9 @@ spec: image: {{ include "codefresh-gitops-runtime.image.name" (dict "image" $imageContext "context" .) }} env: {{- include "codefresh-gitops-runtime.env-vars" (dict "Values" $mergedValues "context" .) | nindent 8 }} imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.command }} command: - {{- if .Values.command }} - {{- .Values.command | toYaml | nindent 8 }} + {{- . | toYaml | nindent 8 }} {{- end }} {{- with .Values.extraArgs }} args: From e19837d2555dbe7fd547fad69746cb13bc1e0223 Mon Sep 17 00:00:00 2001 From: Mikhail Klimko Date: Tue, 4 Nov 2025 15:16:06 +0300 Subject: [PATCH 8/9] feat(gitops-operator): add debug flag --- .../templates/_components/gitops-operator/_default_values.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl index 18df315d6..6a2c9e2af 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_default_values.tpl @@ -88,7 +88,7 @@ extraVolumeMounts: [] affinity: {} debug: - enabled: true + enabled: false image: registry: registry.k8s.io repository: pause From 819bf218bc5daeb140332ed02208c71216c70a9e Mon Sep 17 00:00:00 2001 From: scme0 Date: Wed, 5 Nov 2025 07:20:03 +0100 Subject: [PATCH 9/9] exclude probes in debug mode --- .../templates/_components/gitops-operator/_deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml index afb3e632d..7c5272d60 100644 --- a/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/gitops-operator/_deployment.yaml @@ -65,6 +65,7 @@ spec: containerPort: 8080 - name: http-health containerPort: 8081 + {{- if not .Values.debug.enabled }} readinessProbe: initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} @@ -83,6 +84,7 @@ spec: httpGet: port: http-health path: /healthz + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: