Skip to content

Commit

Permalink
feat: ✨ add cacert with schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry GAMEIRO MARTINS committed Oct 1, 2024
1 parent 8efcf94 commit 8397089
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
16 changes: 8 additions & 8 deletions charts/vscode-python/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ spec:
mkdir /dest/metaflow;
cp /src/metaflow/config.json /dest/metaflow/config.json;
{{- end }}
{{- if .Values.certificateAuthorityInjection }}
{{- if .Values.certificateAuthorityInjection.cacerts }}
{{- if .Values.certificates }}
{{- if .Values.certificates.cacerts }}
mkdir /dest/certs;
if [[ {{ .Values.certificateAuthorityInjection.cacerts }} =~ ^https?://.+$ ]];
if [[ {{ .Values.certificates.cacerts }} =~ ^https?://.+$ ]];
then
curl -s {{ .Values.certificateAuthorityInjection.cacerts }} -o /tmp/ca.pem
curl -s {{ .Values.certificates.cacerts }} -o /tmp/ca.pem
else
echo -n {{ .Values.certificateAuthorityInjection.cacerts }} | base64 -d > /tmp/ca.pem;
echo -n {{ .Values.certificates.cacerts }} | base64 -d > /tmp/ca.pem;
fi
awk 'BEGIN {c=0;} /BEGIN CERT/{c++} { print > "/tmp/cert." c ".crt"}' < /tmp/ca.pem;
cp /tmp/*.crt /dest/certs/;
Expand Down Expand Up @@ -231,10 +231,10 @@ spec:
mountPath: /home/{{ .Values.environment.user}}/.metaflowconfig
subPath: metaflow
{{- end }}
{{- if .Values.certificateAuthorityInjection }}
{{- if .Values.certificateAuthorityInjection.pathToCaBundle }}
{{- if .Values.certificates }}
{{- if .Values.certificates.pathToCaBundle }}
- name: config-files
mountPath: {{ .Values.certificateAuthorityInjection.pathToCaBundle }}
mountPath: {{ .Values.certificates.pathToCaBundle }}
subPath: certs
{{- end }}
{{- end }}
Expand Down
11 changes: 6 additions & 5 deletions charts/vscode-python/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,27 +837,28 @@
}
}
},
"certificateAuthorityInjection": {
"certificates": {
"description": "It can be used to inject certificate authority into the services, if the Helm chart in the catalog allows it you can bind this value to the Helm chart value to add some certificate authorities in the pod.",
"type": "object",
"x-onyxia": {
"overwriteSchemaWith": "certificates.json"
},
"default": {},
"properties": {
"cacerts": {
"type": "string",
"description": "String of crts concatenated in base64, can be a url",
"default": "",
"x-onyxia": {
"hidden": true,
"overwriteDefaultWith": "{{certificateAuthorityInjection.cacerts}}"
"hidden": true
}
},
"pathToCaBundle": {
"type": "string",
"description": "String path where a bundle is made or injected by third party solution",
"default": "/usr/local/share/ca-certificates/",
"x-onyxia": {
"hidden": true,
"overwriteDefaultWith": "{{certificateAuthorityInjection.pathToCaBundle}}"
"hidden": true
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions charts/vscode-python/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ proxy:
httpProxy: ""
httpsProxy: ""

# certificateAuthorityInjection:
# pathToCaBundle:
# cacerts:
certificates: {}
# pathToCaBundle: /usr/local/share/ca-certificates/
# cacerts: ""

message:
fr: ""
Expand Down

0 comments on commit 8397089

Please sign in to comment.