From 32fb0c79d06adc1807271db0c67c400beb1a018c Mon Sep 17 00:00:00 2001 From: Gary Pennington Date: Wed, 16 Nov 2022 12:26:38 +0000 Subject: [PATCH 1/2] add a supergraph configmap option to the helm chart Here's an example of values.yaml that you could use to mount this to your container: ``` extraEnvVars: - name: APOLLO_ROUTER_SUPERGRAPH_PATH value: /data/supergraph-schema.graphql extraVolumeMounts: - name: supergraph-schema mountPath: /data readOnly: true extraVolumes: - name: supergraph-schema configMap: name: "{{ .Release.Name }}-supergraph" items: - key: supergraph-schema.graphql path: supergraph-schema.graphql ``` Note: This takes advantage of the fact that we `tpl` template the extraVolumes in the deployment template, so {{ .Release.Name }} will be templated into the release name at install. You don't have to do this, you could just hard-code it, but this is neater. Here's an example command line: ``` helm upgrade --install --create-namespace --namespace router-test --set-file supergraphFile=supergraph-schema.graphql router-test oci://ghcr.io/apollographql/helm-charts/router --version 1.0.0-rc.9 --values values.yaml ``` NB: rc.9 doesn't exist, so the command is purely illustrative to show how this works. --- helm/chart/router/templates/supergraph-cm.yaml | 12 ++++++++++++ helm/chart/router/values.yaml | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 helm/chart/router/templates/supergraph-cm.yaml diff --git a/helm/chart/router/templates/supergraph-cm.yaml b/helm/chart/router/templates/supergraph-cm.yaml new file mode 100644 index 0000000000..40ff9d073a --- /dev/null +++ b/helm/chart/router/templates/supergraph-cm.yaml @@ -0,0 +1,12 @@ +{{- if .Values.supergraphFile }} +{{- $routerFullName := include "router.fullname" . -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ $routerFullName }}-supergraph + labels: + {{- include "router.labels" . | nindent 4 }} +data: + supergraph-schema.graphql: |- +{{ .Values.supergraphFile | indent 4 }} +{{- end }} diff --git a/helm/chart/router/values.yaml b/helm/chart/router/values.yaml index 2caaf0b8ed..62a5fbfb9d 100644 --- a/helm/chart/router/values.yaml +++ b/helm/chart/router/values.yaml @@ -30,6 +30,10 @@ managedFederation: # -- If using managed federation, the variant of which graph to use graphRef: "" +# This should not be specified in values.yaml. It's much simpler to use --set-file from helm command line. +# e.g.: helm ... --set-file supergraphFile="location of your supergraph file" +supergraphFile: + # An array of extra environmental variables # Example: # extraEnvVars: From 89f27c5eeaf2d7feade74491a4a7c1900769612d Mon Sep 17 00:00:00 2001 From: Gary Pennington Date: Thu, 17 Nov 2022 09:40:59 +0000 Subject: [PATCH 2/2] add a changelog --- NEXT_CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 5e54d34b87..9ac1a0396a 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -26,6 +26,38 @@ By [@USERNAME](https://github.com/USERNAME) in https://github.com/apollographql/ # [x.x.x] (unreleased) - 2022-mm-dd ## ❗ BREAKING ❗ ## 🚀 Features + +### Add a supergraph configmap option to the helm chart ([PR #2119](https://github.com/apollographql/router/pull/2119)) + +Adds the capability to create a configmap containing your supergraph schema. Here's an example of how you could make use of this from your values.yaml and with the `helm` install command. + +```yaml +extraEnvVars: + - name: APOLLO_ROUTER_SUPERGRAPH_PATH + value: /data/supergraph-schema.graphql + +extraVolumeMounts: + - name: supergraph-schema + mountPath: /data + readOnly: true + +extraVolumes: + - name: supergraph-schema + configMap: + name: "{{ .Release.Name }}-supergraph" + items: + - key: supergraph-schema.graphql + path: supergraph-schema.graphql +``` + +With that values.yaml content, and with your supergraph schema in a file name supergraph-schema.graphql, you can execute: + +``` +helm upgrade --install --create-namespace --namespace router-test --set-file supergraphFile=supergraph-schema.graphql router-test oci://ghcr.io/apollographql/helm-charts/router --version 1.0.0-rc.9 --values values.yaml +``` + +By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/2119 + ## 🐛 Fixes ## 🛠 Maintenance ## 📚 Documentation