From 183866dd97da69965245546318068338d105531c Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Wed, 16 Oct 2019 14:32:11 -0700 Subject: [PATCH 1/2] Adding a config.toml value to the helm chart Fixes https://github.com/gomods/athens/issues/1405 cc/ @hypnoglow --- .../athens-proxy/templates/config-configtoml.yaml | 14 ++++++++++++++ charts/athens-proxy/templates/deployment.yaml | 10 ++++++++++ charts/athens-proxy/values.yaml | 10 ++++++++++ 3 files changed, 34 insertions(+) create mode 100644 charts/athens-proxy/templates/config-configtoml.yaml diff --git a/charts/athens-proxy/templates/config-configtoml.yaml b/charts/athens-proxy/templates/config-configtoml.yaml new file mode 100644 index 000000000..8af84faac --- /dev/null +++ b/charts/athens-proxy/templates/config-configtoml.yaml @@ -0,0 +1,14 @@ +{{- if .Values.configToml.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-configtoml + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + config.toml: |- + {{ .Values.configToml.data }} +{{- end -}} diff --git a/charts/athens-proxy/templates/deployment.yaml b/charts/athens-proxy/templates/deployment.yaml index c475af4cc..71a4f44d2 100644 --- a/charts/athens-proxy/templates/deployment.yaml +++ b/charts/athens-proxy/templates/deployment.yaml @@ -155,6 +155,11 @@ spec: mountPath: "/usr/local/lib" readOnly: true {{- end }} + {{- if .Values.configToml}} + - name: configtoml + mountPath: "/config" + readOnly: true + {{- end }} {{- if .Values.netrc.enabled }} - name: netrc mountPath: "/etc/netrc" @@ -192,6 +197,11 @@ spec: configMap: name: {{ template "fullname" . }}-upstream {{- end }} + {{- if .Values.configToml.enabled }} + - name: configtoml-config + configMap: + name: {{ template "fullname" .}}-configtoml + {{- end }} {{- if .Values.netrc.enabled }} - name: netrc secret: diff --git a/charts/athens-proxy/values.yaml b/charts/athens-proxy/values.yaml index dda399494..6405435a6 100644 --- a/charts/athens-proxy/values.yaml +++ b/charts/athens-proxy/values.yaml @@ -82,6 +82,16 @@ gitconfig: # Key in the kubernetes secret that contains git config data. secretKey: gitconfig +configToml: + enabled: false + data: |- + # See https://docs.gomods.io/configuration/ for an introduction on what + # values you can put in here. + # + # Otherwise, for an exhaustive list of the configuration values you + # can put here, see config.dev.toml at the root of the + # github.com/gomods/athens repository + upstreamProxy: # This is where you can set the URL for the upstream module repository. # If 'enabled' is set to true, Athens will try to download modules from the upstream when it doesn't find them in its own storage. From 8ac51c8241b973a9b28f86841a5c5569ce79f283 Mon Sep 17 00:00:00 2001 From: Aaron Schlesinger Date: Wed, 16 Oct 2019 14:43:46 -0700 Subject: [PATCH 2/2] Adding some docs --- docs/content/install/install-on-kubernetes.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/content/install/install-on-kubernetes.md b/docs/content/install/install-on-kubernetes.md index 0a1757531..b968706b7 100644 --- a/docs/content/install/install-on-kubernetes.md +++ b/docs/content/install/install-on-kubernetes.md @@ -288,3 +288,22 @@ helm install gomods/athens-proxy --name athens --namespace athens \ --set gitconfig.secretName=athens-proxy-gitconfig \ --set gitconfig.secretKey=gitconfig ``` + +### Overriding the default `config.toml` + +The [Docker images for Athens](https://hub.docker.com/r/gomods/athens) come with a default `config.toml` file (which is the same as the [`config.dev.toml`](https://github.com/gomods/athens/blob/master/config.dev.toml)) in the repository). We've added lots of common configuration values to the Helm chart that you might like to override, but if you're interested in setting a huge set of configuration values, or values that the chart doesn't currently let you set, you might want to set up your own `config.toml` and inject that into your Athens pods in your Kubernetes deployment. + +The Athens chart supports doing that via a `configToml.enabled` and `configToml.data` value. Since your `config.toml` file will have newlines in it and will likely be large, we recommend that you add your complete `config.toml` to an `override-values.yaml` file above. Here is what the relevant section of your `override-values.yaml` file should look like: + +```yaml +configToml: + enabled: true + data: |- + +``` + +After you have your complete `override-values.yaml` set up, including your new `configToml` section, you can run your `helm install` command as above: + +```console +$ helm install gomods/athens-proxy -n athens --namespace athens -f override-values.yaml +``` \ No newline at end of file