-
Notifications
You must be signed in to change notification settings - Fork 197
[BUG] - Modified labels and annotations logic for deployments #485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
[BUG] - Modified labels and annotations logic for deployments #485
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in Helm templates where label and annotation loops were executing regardless of whether the values were empty, causing ArgoCD reconciliation issues with Kyverno injections. The fix replaces range loops with with control structures that only execute when values are non-empty.
- Replaced
rangeloops withwithcontrol structures for pod labels and annotations - Changed output format from individual key-value pairs to YAML blocks using
toYaml - Applied the fix consistently across all deployment types (jobs, statefulsets, deployments)
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| analyzertrain-statefulset.yaml | Updated pod labels and annotations logic for analyzer train statefulset |
| analyzer-statefulset.yaml | Updated pod labels and annotations logic for analyzer statefulset |
| ui-deployment.yaml | Updated pod labels and annotations logic for UI deployment |
| migrations-job.yaml | Updated pod labels and annotations logic for migrations job |
| jobs-deployment.yaml | Updated pod labels and annotations logic for jobs deployment |
| index-deployment.yaml | Updated pod labels and annotations logic for index deployment |
| uat-deployment.yaml | Updated pod labels and annotations logic for UAT deployment |
| api-deployment.yaml | Updated pod labels and annotations logic for API deployment |
| {{- range $key, $value := .Values.serviceanalyzertrain.podLabels }} | ||
| {{ $key }}: {{ $value | quote }} | ||
| {{- with .Values.serviceanalyzertrain.podLabels }} | ||
| {{- toYaml . | nindent 4 }} |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nindent value of 4 may not provide proper indentation for labels in YAML. Labels should typically be indented to align with the 'labels:' key, which would require 8 spaces based on the visible indentation structure.
| {{- toYaml . | nindent 4 }} | |
| {{- toYaml . | nindent 8 }} |
| {{- range $key, $value := .Values.serviceanalyzertrain.podAnnotations }} | ||
| {{ $key }}: {{ $value | quote }} | ||
| {{- with .Values.serviceanalyzertrain.podAnnotations }} | ||
| {{- toYaml . | nindent 4 }} |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nindent value of 4 may not provide proper indentation for annotations in YAML. Annotations should typically be indented to align with the 'annotations:' key, which would require 8 spaces based on the visible indentation structure.
| {{- toYaml . | nindent 4 }} | |
| {{- toYaml . | nindent 8 }} |
While attempting to deploy reportportal using ArgoCD, my teammates and I noticed the deployment was failing due to ArgoCD trying to reconcile the chart with injection modifications done by Kyverno.
This was determined to be because a loop is executed regardless of content. To correct for this, I've updated the deployment types: jobs, statefulsets, and deployments to use the
withcontrol structure which only executes if the values are non-empty per here.