Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changesets/fix_glasser_helm_deployment_annotations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Enable annotations on deployments via Helm Chart ([PR #8164](https://github.com/apollographql/router/pull/8164))

The Helm chart previously did not allow customization of annotations on the deployment itself (as opposed to the pods within it, which is done with `podAnnotations`); this can now be done with the `deploymentAnnotations` value.

By [@glasser](https://github.com/glasser) in https://github.com/apollographql/router/pull/8164
1 change: 1 addition & 0 deletions docs/shared/helm-show-router-output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ serviceAccount:
name: ""

podAnnotations: {}
deploymentAnnotations: {}

podSecurityContext:
{}
Expand Down
3 changes: 2 additions & 1 deletion helm/chart/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ helm show values oci://ghcr.io/apollographql/helm-charts/router
| containerPorts.health | int | `8088` | For exposing the health check endpoint |
| containerPorts.http | int | `4000` | If you override the port in `router.configuration.server.listen` then make sure to match the listen port here |
| containerPorts.metrics | int | `9090` | For exposing the metrics port when running a serviceMonitor for example |
| deploymentAnnotations | object | `{}` | Sets annotations for the deployment resource itself (not its pods) |
| extraContainers | list | `[]` | An array of extra containers to include in the router pod Example: extraContainers: - name: coprocessor image: acme/coprocessor:1.0 ports: - containerPort: 4001 |
| extraEnvVars | list | `[]` | |
| extraEnvVarsCM | string | `""` | |
Expand Down Expand Up @@ -71,7 +72,7 @@ helm show values oci://ghcr.io/apollographql/helm-charts/router
| managedFederation.graphRef | string | `""` | If using managed federation, the variant of which graph to use |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podAnnotations | object | `{}` | Sets annotations for individual pods in the deployment |
| podDisruptionBudget | object | `{}` | Sets the [pod disruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) for Deployment pods |
| podSecurityContext | object | `{}` | |
| priorityClassName | string | `""` | Set to existing PriorityClass name to control pod preemption by the scheduler |
Expand Down
6 changes: 4 additions & 2 deletions helm/chart/router/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ metadata:
{{- if .Values.extraLabels }}
{{- include "apollographql.templatizeExtraLabels" . | trim | nindent 4 }}
{{- end }}
annotations:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is ok in k8s for an object to just be foo: with no values underneath.

{{/* There may not be much configuration so check that there is something */}}
{{/* NOTE: metrics configuration moved under telemetry.exporters in Router 1.35.0 */}}
{{- if ((((((.Values.router).configuration).telemetry).exporters).metrics).prometheus).enabled }}
annotations:
prometheus.io/path: {{ .Values.router.configuration.telemetry.exporters.metrics.prometheus.path | default "/metrics" }}
prometheus.io/port: {{ (splitList ":" .Values.router.configuration.telemetry.exporters.metrics.prometheus.listen | last) | default "9090" | quote }}
prometheus.io/scrape: "true"
{{- else if (((((.Values.router).configuration).telemetry).metrics).prometheus).enabled }}
annotations:
prometheus.io/path: {{ .Values.router.configuration.telemetry.metrics.prometheus.path | default "/metrics" }}
prometheus.io/port: {{ (splitList ":" .Values.router.configuration.telemetry.metrics.prometheus.listen | last) | default "9090" | quote }}
prometheus.io/scrape: "true"
{{- end }}
Comment on lines 10 to 21
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what were the annotations doing before? it looks like duplicate blocks of the same annotations? now, it looks like we have the duplicate entries under the same annotations block?

Copy link
Copy Markdown
Member Author

@glasser glasser Sep 4, 2025

Choose a reason for hiding this comment

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

These are specific annotations defined by this field. This PR lets you also add your own annotations too.

We already let users add annotations to all sorts of other places, just not deployments. Providing hooks for arbitrary annotations is pretty standard for charts since Helm doesn't let you make these changes as a chart consumer without an explicit hook.

{{- if .Values.deploymentAnnotations }}
{{- toYaml .Values.deploymentAnnotations | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
Expand Down
1 change: 1 addition & 0 deletions helm/chart/router/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ serviceAccount:
name: ""

podAnnotations: {}
deploymentAnnotations: {}

podSecurityContext:
{}
Expand Down