Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom config.toml from existing secret or plain text #73

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions charts/athens-proxy/ci/config-values.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions charts/athens-proxy/templates/config-toml.yaml
Original file line number Diff line number Diff line change
@@ -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 -}}
21 changes: 20 additions & 1 deletion charts/athens-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,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"
Expand Down Expand Up @@ -267,6 +276,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:
Expand Down
14 changes: 14 additions & 0 deletions charts/athens-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,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
Expand Down