From e0fc81d87d436b1c18df7d38dfcb02bfc2867a65 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:06:39 +0200 Subject: [PATCH 01/10] feat: custom config.toml from existing secret or plain text --- charts/athens-proxy/ci/config-values.yaml | 17 +++++++++++++++ .../athens-proxy/templates/config-toml.yaml | 11 ++++++++++ charts/athens-proxy/templates/deployment.yaml | 21 ++++++++++++++++++- charts/athens-proxy/values.yaml | 14 +++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 charts/athens-proxy/ci/config-values.yaml create mode 100644 charts/athens-proxy/templates/config-toml.yaml diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml new file mode 100644 index 0000000..d8962e3 --- /dev/null +++ b/charts/athens-proxy/ci/config-values.yaml @@ -0,0 +1,17 @@ +sshGitServers: + - host: git1.example.com + user: git + privateKey: "invalid key" + - host: git2.example.com + user: git + existingSecret: + name: ssh-keys + subPath: secret.id_rsa + +config: + enabled: true +# existingSecret: +# name: foo +# subPath: bar.toml + toml: |- + # custom config.toml enabled: {{ .Values.config.enabled }} 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..bf9e1b1 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 + # toml: |- + # # config.toml contents + # # can use helm templates {{ .Values.xxx }} + metrics: serviceMonitor: # -- Create a ServiceMonitor for prometheus From 0c7039d302eee7deac1b37a90759f49d8e005344 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:09:56 +0200 Subject: [PATCH 02/10] doc: link to config.toml in athens repo --- charts/athens-proxy/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/athens-proxy/values.yaml b/charts/athens-proxy/values.yaml index bf9e1b1..ec70585 100644 --- a/charts/athens-proxy/values.yaml +++ b/charts/athens-proxy/values.yaml @@ -218,7 +218,7 @@ config: # existingSecret: # name: athens-config # subPath: config.toml - ## Plain text 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 }} From 9ba3e995115f4a525646464be4e2724f0227c206 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:16:41 +0200 Subject: [PATCH 03/10] fix: remove reference to nonexisting secret in test config --- charts/athens-proxy/ci/config-values.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index d8962e3..c7fb54a 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -2,11 +2,6 @@ sshGitServers: - host: git1.example.com user: git privateKey: "invalid key" - - host: git2.example.com - user: git - existingSecret: - name: ssh-keys - subPath: secret.id_rsa config: enabled: true From 1311461ce2ec18dfd8ee6f63a226af074e83ae0f Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:29:03 +0200 Subject: [PATCH 04/10] fix: add basic required config --- charts/athens-proxy/ci/config-values.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index c7fb54a..98357a9 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -10,3 +10,9 @@ config: # subPath: bar.toml toml: |- # custom config.toml enabled: {{ .Values.config.enabled }} + GoBinary = "go" + GoEnv = "development" + ProtocolWorkers = 30 + LogLevel = "debug" + CloudRuntime = "none" + NetworkMode = "strict" From fe93ee998af03340f692579d6c947f3043bb81c6 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:37:44 +0200 Subject: [PATCH 05/10] fix: add basic required config --- charts/athens-proxy/ci/config-values.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index 98357a9..502164a 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -12,7 +12,12 @@ config: # custom config.toml enabled: {{ .Values.config.enabled }} GoBinary = "go" GoEnv = "development" - ProtocolWorkers = 30 + GoGetWorkers = 3 + ProtocolWorkers = 10 LogLevel = "debug" - CloudRuntime = "none" + LogFormat = "plain" NetworkMode = "strict" + StorageType = "memory" + ShutdownTimeout = 5 + TimeoutConf: + Timeout: 60 \ No newline at end of file From ccbf2601defbc0806d6ef60f07c3aada808f5130 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:38:07 +0200 Subject: [PATCH 06/10] fix: add basic required config --- charts/athens-proxy/ci/config-values.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index 502164a..9597886 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -19,5 +19,4 @@ config: NetworkMode = "strict" StorageType = "memory" ShutdownTimeout = 5 - TimeoutConf: - Timeout: 60 \ No newline at end of file + Timeout: 60 \ No newline at end of file From 483d33bcfe27674cfaaa2267e83c210da4f112c7 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:40:54 +0200 Subject: [PATCH 07/10] fix: add basic required config --- charts/athens-proxy/ci/config-values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index 9597886..d194033 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -19,4 +19,4 @@ config: NetworkMode = "strict" StorageType = "memory" ShutdownTimeout = 5 - Timeout: 60 \ No newline at end of file + Timeout: 60 From 479bfaed891df6b990cd96efb5e4c4bb9087616a Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 22:53:11 +0200 Subject: [PATCH 08/10] fix: fix basic required config --- charts/athens-proxy/ci/config-values.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index d194033..afa479d 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -19,4 +19,9 @@ config: NetworkMode = "strict" StorageType = "memory" ShutdownTimeout = 5 - Timeout: 60 + Timeout = 60 + [Storage] + [Storage.Disk] + RootPath = /var/lib/athens + [Index] + # no config needed From 894edaea952d932e85ad03e003b84e90dcd27455 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 23:00:59 +0200 Subject: [PATCH 09/10] fix: fix basic required config --- charts/athens-proxy/ci/config-values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index afa479d..ace8e2b 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -18,10 +18,10 @@ config: LogFormat = "plain" NetworkMode = "strict" StorageType = "memory" + IndexType = "none" ShutdownTimeout = 5 Timeout = 60 [Storage] - [Storage.Disk] - RootPath = /var/lib/athens + # no config needed [Index] # no config needed From 150cc16fdf2b534c7ec0427849cea2ebec5e4d41 Mon Sep 17 00:00:00 2001 From: DrPsychick Date: Mon, 6 May 2024 23:09:43 +0200 Subject: [PATCH 10/10] fix: fix basic required config --- charts/athens-proxy/ci/config-values.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/charts/athens-proxy/ci/config-values.yaml b/charts/athens-proxy/ci/config-values.yaml index ace8e2b..48b87f0 100644 --- a/charts/athens-proxy/ci/config-values.yaml +++ b/charts/athens-proxy/ci/config-values.yaml @@ -11,17 +11,22 @@ config: 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" - StorageType = "memory" + Port = ":3000" + StorageType = "disk" IndexType = "none" ShutdownTimeout = 5 Timeout = 60 [Storage] - # no config needed + [Storage.Disk] + RootPath = "/var/lib/athens" [Index] # no config needed