diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml new file mode 100644 index 0000000..48b87f0 --- /dev/null +++ b/charts/athens-proxy/ci/config-values.yaml @@ -0,0 +1,32 @@ +sshGitServers: + - host: git1.example.com + user: git + privateKey: "invalid key" + +config: + enabled: true +# existingSecret: +# name: foo +# subPath: bar.toml + toml: |- + # custom config.toml enabled: {{ .Values.config.enabled }} + GoBinary = "go" + GoBinaryEnvVars = ["GOPROXY=direct"] + GoEnv = "development" + GoGetDir = "" + GoGetWorkers = 3 + ProtocolWorkers = 10 + LogLevel = "debug" + LogFormat = "plain" + DownloadMode = "sync" + NetworkMode = "strict" + Port = ":3000" + StorageType = "disk" + IndexType = "none" + ShutdownTimeout = 5 + Timeout = 60 + [Storage] + [Storage.Disk] + RootPath = "/var/lib/athens" + [Index] + # no config needed diff --git a/charts/athens-proxy/templates/config-toml.yaml b/charts/athens-proxy/templates/config-toml.yaml new file mode 100644 index 0000000..e98cf56 --- /dev/null +++ b/charts/athens-proxy/templates/config-toml.yaml @@ -0,0 +1,11 @@ +{{- if and .Values.config.enabled (not .Values.config.existingSecret) -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-config + labels: + {{- include "athens.metaLabels" . | nindent 4 }} +data: + config.toml: |- + {{- tpl .Values.config.toml . | nindent 4 }} +{{- end -}} diff --git a/charts/athens-proxy/templates/deployment.yaml b/charts/athens-proxy/templates/deployment.yaml index 634bfbd..a999219 100644 --- a/charts/athens-proxy/templates/deployment.yaml +++ b/charts/athens-proxy/templates/deployment.yaml @@ -216,13 +216,22 @@ spec: {{- end }} ports: - containerPort: 3000 - {{- if or (eq .Values.storage.type "disk") .Values.upstreamProxy.enabled .Values.netrc.enabled .Values.sshGitServers .Values.gitconfig.enabled}} + {{- if or (eq .Values.storage.type "disk") .Values.upstreamProxy.enabled .Values.netrc.enabled .Values.sshGitServers .Values.gitconfig.enabled .Values.config.enabled }} volumeMounts: {{- end }} {{- if eq .Values.storage.type "disk" }} - name: storage-volume mountPath: {{ .Values.storage.disk.storageRoot | quote }} {{- end }} + {{- if .Values.config.enabled }} + - name: athens-config + mountPath: {{ .Values.config.path | quote }} + {{- if .Values.config.existingSecret }} + subPath: {{ .Values.config.existingSecret.subPath }} + {{- else }} + subPath: config.toml + {{- end }} + {{- end }} {{- if .Values.upstreamProxy.enabled }} - name: upstream-config mountPath: "/usr/local/lib" @@ -271,6 +280,16 @@ spec: {{- else }} emptyDir: {} {{- end }} + {{- if .Values.config.enabled }} + - name: athens-config + {{- if .Values.config.existingSecret }} + secret: + secretName: {{ .Values.config.existingSecret.name }} + {{- else }} + configMap: + name: {{ template "fullname" . }}-config + {{- end }} + {{- end }} {{- if .Values.upstreamProxy.enabled }} - name: upstream-config configMap: diff --git a/charts/athens-proxy/values.yaml b/charts/athens-proxy/values.yaml index 8bf5c6e..ec70585 100644 --- a/charts/athens-proxy/values.yaml +++ b/charts/athens-proxy/values.yaml @@ -209,6 +209,20 @@ sshGitServers: [] # -- Specify the number of go workers goGetWorkers: 3 +## Provide a custom config.toml file to Athens +config: + enabled: false + ## Mount path of config.toml + path: /config/config.toml + ## Use config.toml from an existing secret + # existingSecret: + # name: athens-config + # subPath: config.toml + ## Plain text config.toml (see https://github.com/gomods/athens/blob/main/config.dev.toml) + # toml: |- + # # config.toml contents + # # can use helm templates {{ .Values.xxx }} + metrics: serviceMonitor: # -- Create a ServiceMonitor for prometheus