Skip to content

Commit

Permalink
feat(privateCA): standalone Docker image created for CA certificate i…
Browse files Browse the repository at this point in the history
…njection

As the installing `openssl` package was violating `runAsNonRoot` rule privacy context, a standalone Docker image created make those package(s) pre-installed.
  • Loading branch information
kaanyagci committed Sep 5, 2023
1 parent 2ef40a3 commit 7ed9742
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
uses: substra/substra-gha-workflows/.github/workflows/docker-build.yaml@main
with:
image: substra-backend

ca-cert-injector:
uses: substra/substra-gha-workflows/.github/workflows/docker-build.yaml@main
with:
image: substra-backend-ca-cert-injector
image-folder: ca-cert-injector
metrics-exporter:
uses: substra/substra-gha-workflows/.github/workflows/docker-build.yaml@main
with:
Expand Down
4 changes: 0 additions & 4 deletions charts/substra-backend/templates/deployment-api-events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ spec:
command: ['sh', '-c']
args:
- |
{{- if .Values.privateCa.image.apkAdd }}
apt update
apt install -y ca-certificates openssl
{{- end }}
update-ca-certificates && cp /etc/ssl/certs/* /tmp/certs/
volumeMounts:
- mountPath: /usr/local/share/ca-certificates/{{ .Values.privateCa.configMap.fileName }}
Expand Down
4 changes: 0 additions & 4 deletions charts/substra-backend/templates/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ spec:
command: ['sh', '-c']
args:
- |
{{- if .Values.privateCa.image.apkAdd }}
apt update
apt install -y ca-certificates openssl
{{- end }}
update-ca-certificates && cp /etc/ssl/certs/* /tmp/certs/
volumeMounts:
- mountPath: /usr/local/share/ca-certificates/{{ .Values.privateCa.configMap.fileName }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ spec:
command: ['sh', '-c']
args:
- |
{{- if .Values.privateCa.image.apkAdd }}
apt update
apt install -y ca-certificates openssl
{{- end }}
update-ca-certificates && cp /etc/ssl/certs/* /tmp/certs/
volumeMounts:
- mountPath: /usr/local/share/ca-certificates/{{ .Values.privateCa.configMap.fileName }}
Expand Down
4 changes: 0 additions & 4 deletions charts/substra-backend/templates/statefulset-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ spec:
command: ['sh', '-c']
args:
- |
{{- if .Values.privateCa.image.apkAdd }}
apt update
apt install -y ca-certificates openssl
{{- end }}
update-ca-certificates && cp /etc/ssl/certs/* /tmp/certs/
volumeMounts:
- mountPath: /usr/local/share/ca-certificates/{{ .Values.privateCa.configMap.fileName }}
Expand Down
10 changes: 7 additions & 3 deletions charts/substra-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ privateCa:
## @param privateCa.image.apkAdd Install the update-ca-certificates package
##
image:
repository: ubuntu
tag: latest
registry: ghcr.io
repository: substra-backend-ca-cert-injector
tag: null
pullPolicy: IfNotPresent
apkAdd: true
## Optionally specify an array of imagePullSecrets.
## Secrets must be created manually in the namespace.
##
pullSecrets: []
## @param privateCa.configMap.name Name of the _ConfigMap_ containing the private CA certificate
## @param privateCa.configMap.data Certificate to add in the _ConfigMap_
## @param privateCa.configMap.fileName Certificate filename in the _ConfigMap_
Expand Down
3 changes: 3 additions & 0 deletions docker/ca-cert-injector/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ubuntu:latest

RUN apt-get update && apt-get install -y ca-certificates openssl
4 changes: 4 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ build:
strip: backend/
docker:
dockerfile: docker/substra-backend/Dockerfile
- image: substra/ca-cert-injector
context: .
docker:
dockerfile: docker/ca-cert-injector/Dockerfile

deploy:
helm:
Expand Down

0 comments on commit 7ed9742

Please sign in to comment.