From fc327989fdf1553303a431537642a9104fab4262 Mon Sep 17 00:00:00 2001 From: titigmr <56739959+titigmr@users.noreply.github.com> Date: Thu, 20 Jun 2024 08:43:30 +0000 Subject: [PATCH] enh(vscode): :tada: add proxy support --- charts/vscode-python/Chart.yaml | 4 +-- .../templates/configmap-proxy.yaml | 1 + .../vscode-python/templates/statefulset.yaml | 34 ++++++++++++++++++- charts/vscode-python/values.schema.json | 33 ++++++++++++++++++ 4 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 charts/vscode-python/templates/configmap-proxy.yaml diff --git a/charts/vscode-python/Chart.yaml b/charts/vscode-python/Chart.yaml index 3d4313d2..11fbcc66 100644 --- a/charts/vscode-python/Chart.yaml +++ b/charts/vscode-python/Chart.yaml @@ -23,9 +23,9 @@ type: application # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.11.35 +version: 1.11.36 dependencies: - name: library-chart - version: 1.5.23 + version: 1.5.24 repository: https://inseefrlab.github.io/helm-charts-interactive-services diff --git a/charts/vscode-python/templates/configmap-proxy.yaml b/charts/vscode-python/templates/configmap-proxy.yaml new file mode 100644 index 00000000..a175f1f7 --- /dev/null +++ b/charts/vscode-python/templates/configmap-proxy.yaml @@ -0,0 +1 @@ +{{ include "library-chart.configMapProxy" . }} \ No newline at end of file diff --git a/charts/vscode-python/templates/statefulset.yaml b/charts/vscode-python/templates/statefulset.yaml index d1735ee3..58d87d30 100644 --- a/charts/vscode-python/templates/statefulset.yaml +++ b/charts/vscode-python/templates/statefulset.yaml @@ -71,6 +71,11 @@ spec: secret: secretName: {{ include "library-chart.secretNameMetaflow" . }} {{- end }} + {{- if .Values.proxyInjection }} + - name: cm-proxy + configMap: + name: {{ printf "%s-configmapproxy" (include "library-chart.fullname" .) }} + {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} @@ -94,6 +99,10 @@ spec: mkdir /dest/metaflow; cp /src/metaflow/config.json /dest/metaflow/config.json; {{- end }} + {{- if .Values.proxyInjection }} + mkdir /dest/environment; + cp /src/environment/environment /dest/environment/environment; + {{- end }} volumeMounts: - name: config-files mountPath: /dest @@ -105,6 +114,10 @@ spec: - name : secret-metaflow mountPath: /src/metaflow {{- end }} + {{- if .Values.proxyInjection }} + - name: cm-proxy + mountPath: /src/environment/ + {{- end }} resources: limits: cpu: 50m @@ -140,6 +153,20 @@ spec: - name: PERSONAL_INIT_ARGS value: {{ .Values.init.personalInitArgs }} {{- end }} + {{- if .Values.proxyInjection }} + {{- if .Values.proxyInjection.httpProxyUrl }} + - name: http_proxy + value: {{ .Values.proxyInjection.httpProxyUrl }} + {{- end }} + {{- if .Values.proxyInjection.httpsProxyUrl }} + - name: https_proxy + value: {{ .Values.proxyInjection.httpsProxyUrl }} + {{- end }} + {{- if .Values.proxyInjection.noProxy }} + - name: no_proxy + value: {{ .Values.proxyInjection.noProxy }} + {{- end }} + {{- end }} - name: PROJECT_USER value: {{ .Values.environment.user }} - name: PROJECT_GROUP @@ -198,7 +225,12 @@ spec: - name: config-files mountPath: /home/{{ .Values.environment.user}}/.metaflowconfig subPath: metaflow - {{- end }} + {{- end }} + {{- if .Values.proxyInjection }} + - name: config-files + mountPath: /etc/environment + subPath: environment/environment + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/vscode-python/values.schema.json b/charts/vscode-python/values.schema.json index f0e2e45a..b79fa222 100644 --- a/charts/vscode-python/values.schema.json +++ b/charts/vscode-python/values.schema.json @@ -655,6 +655,39 @@ } } }, + "proxyInjection": { + "description": "It can be used to inject proxy settings in the services", + "type": "object", + "properties": { + "httpProxyUrl": { + "type": "string", + "description": "URL of the enterprise proxy for the region for HTTP.", + "default": "", + "x-onyxia": { + "hidden": true, + "overwriteDefaultWith": "{{proxyInjection.httpProxyUrl}}" + } + }, + "httpsProxyUrl": { + "type": "string", + "description": "URL of the enterprise proxy for the region for HTTPS.", + "default": "", + "x-onyxia": { + "hidden": true, + "overwriteDefaultWith": "{{proxyInjection.httpsProxyUrl}}" + } + }, + "noProxy": { + "type": "string", + "description": "enterprise local domain that should not take proxy comma separated", + "default": "", + "x-onyxia": { + "hidden": true, + "overwriteDefaultWith": "{{proxyInjection.noProxy}}" + } + } + } + }, "init": { "description": "Init parameters", "type": "object",