Skip to content

Conversation

@tyu0912
Copy link

@tyu0912 tyu0912 commented Jul 23, 2025

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 with control structure which only executes if the values are non-empty per here.

image

@tyu0912 tyu0912 changed the title [BUG] - Scoped labels and annotations logic for deployment s [BUG] - Modified labels and annotations logic for deployments Jul 23, 2025
@raikbitters raikbitters requested a review from Copilot July 24, 2025 12:15
Copy link

Copilot AI left a 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 range loops with with control 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 }}
Copy link

Copilot AI Jul 24, 2025

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.

Suggested change
{{- toYaml . | nindent 4 }}
{{- toYaml . | nindent 8 }}

Copilot uses AI. Check for mistakes.
{{- range $key, $value := .Values.serviceanalyzertrain.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- with .Values.serviceanalyzertrain.podAnnotations }}
{{- toYaml . | nindent 4 }}
Copy link

Copilot AI Jul 24, 2025

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.

Suggested change
{{- toYaml . | nindent 4 }}
{{- toYaml . | nindent 8 }}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant