Skip to content
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

conditionally add annotations key #179

Merged
merged 2 commits into from
Jan 3, 2025
Merged

Conversation

Ivan-Rosa
Copy link
Contributor

While deploying with ArgoCD, I faced and issue where application is out of sync after daemonset restart.

This is because helm render "forces" empty annotations.
image

helm/cert-exporter/Chart.yaml Show resolved Hide resolved
@@ -19,8 +19,10 @@ spec:
{{- with .Values.certManager.additionalPodLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.certManager.podAnnotations }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it currently broken?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not currently broken. However, GitOps tools will detect differences when K8s adds annotations like restartAt.... In contrast, I do not see any value in rendering empty as default.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this diff helps to clarify my previous comments.
When AroCD syncs the application, it will detect changes because of explicit empty annotations in helm render.

# Source: cert-exporter/charts/cert-exporter/templates/cert-m	# Source: cert-exporter/charts/cert-exporter/templates/cert-m
apiVersion: apps/v1						apiVersion: apps/v1
kind: DaemonSet							kind: DaemonSet
metadata:							metadata:
  name: "cert-exporter-cert-manager"				  name: "cert-exporter-cert-manager"
  labels:							  labels:
    helm.sh/chart: cert-exporter-3.9.0			      |	    helm.sh/chart: cert-exporter-3.10.0
    app.kubernetes.io/name: cert-exporter			    app.kubernetes.io/name: cert-exporter
    app.kubernetes.io/instance: cert-exporter			    app.kubernetes.io/instance: cert-exporter
    cert-exporter.io/type: daemon-set				    cert-exporter.io/type: daemon-set
    app.kubernetes.io/version: "v2.14.0"			    app.kubernetes.io/version: "v2.14.0"
    app.kubernetes.io/managed-by: Helm				    app.kubernetes.io/managed-by: Helm
spec:								spec:
  selector:							  selector:
    matchLabels:						    matchLabels:
      app.kubernetes.io/name: cert-exporter			      app.kubernetes.io/name: cert-exporter
      app.kubernetes.io/instance: cert-exporter			      app.kubernetes.io/instance: cert-exporter
      cert-exporter.io/type: daemon-set				      cert-exporter.io/type: daemon-set
  template:							  template:
    metadata:							    metadata:
      labels:							      labels:
        app.kubernetes.io/name: cert-exporter			        app.kubernetes.io/name: cert-exporter
        app.kubernetes.io/instance: cert-exporter		        app.kubernetes.io/instance: cert-exporter
        cert-exporter.io/type: daemon-set			        cert-exporter.io/type: daemon-set
      annotations:					      <
        {}						      <
    spec:							    spec:
      serviceAccountName: cert-exporter				      serviceAccountName: cert-exporter

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i see

glad to remove this. thank you for the improvement! 🙏

@@ -19,8 +19,10 @@ spec:
{{- with .Values.certManager.additionalPodLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.certManager.podAnnotations }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, i see

glad to remove this. thank you for the improvement! 🙏

@joe-elliott joe-elliott merged commit 789feec into joe-elliott:master Jan 3, 2025
1 check passed
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.

2 participants