Skip to content

Support custom annotations on Deployment/StatefulSet metadata #152

@rojo1997

Description

@rojo1997

Problem

When deploying the Valkey Helm chart as a subchart managed by ArgoCD, there is no way to add custom annotations to the Deployment (or StatefulSet) metadata.annotations field.

This is critical for ArgoCD sync-wave orchestration. ArgoCD uses the argocd.argoproj.io/sync-wave annotation on resource metadata to determine the order in which resources are created. Without the ability to set this annotation on the Deployment, it's impossible to control when Valkey is deployed relative to its dependencies (e.g., secrets created by External Secrets Operator).

Current behavior

The chart supports podAnnotations (applied to spec.template.metadata.annotations) but there is no equivalent for the top-level metadata.annotations of the Deployment/StatefulSet resource itself.

Values like customAnnotations are not recognized by the chart and are silently ignored.

Expected behavior

A values key (e.g., deploymentAnnotations or customAnnotations) that allows injecting arbitrary annotations into the Deployment/StatefulSet metadata.annotations block. For example:

deploymentAnnotations:
  argocd.argoproj.io/sync-wave: "2"

Should render as:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-valkey
  annotations:
    argocd.argoproj.io/sync-wave: "2"

Use case

When using ArgoCD with sync-waves, the Valkey Deployment must be created after its dependency secrets exist. Without annotation support on the Deployment metadata, the only workaround is to shift all dependency resources to negative sync-waves, which complicates the overall wave structure of the parent chart.

Suggested implementation

In deploy_valkey.yaml and statefulset.yaml, add an annotations block to the resource metadata:

metadata:
  name: {{ include "valkey.fullname" . }}
  labels:
    {{- include "valkey.labels" . | nindent 4 }}
  {{- with .Values.deploymentAnnotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}

With a corresponding default in values.yaml:

# Annotations to add to the Deployment/StatefulSet resource metadata
deploymentAnnotations: {}

This is consistent with how many other Helm charts handle this (e.g., bitnami charts, ingress-nginx).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions