Merge pull request #50 from jk-cluster/feat/voucher-vault-conventions
VoucherVault chart: complete security hardening, flexible ingress (conventions batch 3)
This commit is contained in:
4 files changed
+70
-13
No files matched your search
@@ -5,7 +5,7 @@ icon: https://raw.githubusercontent.com/l4rm4nd/VoucherVault/main/myapp/static/a
|
|||||||
|
|
||||||
type: application
|
type: application
|
||||||
|
|
||||||
version: 3.1.2+up1.30.1
|
version: 4.0.0+up1.30.1
|
||||||
appVersion: "1.30.1"
|
appVersion: "1.30.1"
|
||||||
|
|
||||||
maintainers:
|
maintainers:
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
|
name: {{ .Release.Name }}-{{ .Chart.Name }}-ingress
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/cluster-issuer: {{ required "A Cluster-Issuer must be provided" .Values.ingress.clusterIssuer}}
|
cert-manager.io/cluster-issuer: {{ required "A Cluster-Issuer must be provided" .Values.ingress.clusterIssuer }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: nginx
|
ingressClassName: {{ .Values.ingress.className }}
|
||||||
rules:
|
rules:
|
||||||
- host: {{ required "A Domain/Host must be provided" .Values.ingress.domain }}
|
- host: {{ required "A Domain/Host must be provided" .Values.ingress.domain }}
|
||||||
http:
|
http:
|
||||||
@@ -22,4 +25,4 @@ spec:
|
|||||||
- hosts:
|
- hosts:
|
||||||
- {{ required "A Domain/Host must be provided" .Values.ingress.domain }}
|
- {{ required "A Domain/Host must be provided" .Values.ingress.domain }}
|
||||||
secretName: tls-{{ .Release.Name }}-{{ .Chart.Name }}-ingress
|
secretName: tls-{{ .Release.Name }}-{{ .Chart.Name }}-ingress
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -19,6 +19,33 @@ spec:
|
|||||||
automountServiceAccountToken: false
|
automountServiceAccountToken: false
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.voucherVault.securityContext.pod | nindent 8 }}
|
{{- toYaml .Values.voucherVault.securityContext.pod | nindent 8 }}
|
||||||
|
initContainers:
|
||||||
|
# STATIC_ROOT (/opt/app/myapp/static) doubles as the app's own static
|
||||||
|
# source directory, so it cannot simply be shadowed by an empty
|
||||||
|
# volume: this init container seeds the static-files emptyDir with
|
||||||
|
# the assets shipped in the image (cp -a preserves timestamps, so the
|
||||||
|
# entrypoint's collectstatic only adds what is missing, e.g. the
|
||||||
|
# Django admin static files). See securityContext in values.yaml.
|
||||||
|
- name: init-static
|
||||||
|
image: "l4rm4nd/vouchervault:{{ .Chart.AppVersion }}"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
# Copies the children (not ".") so cp never tries to set metadata
|
||||||
|
# on the mountpoint itself, which the non-root uid may not own.
|
||||||
|
command: ["sh", "-c", "cp -a /opt/app/myapp/static/* /static-seed/"]
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.voucherVault.securityContext.container | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: static-files
|
||||||
|
mountPath: /static-seed
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
ephemeral-storage: 1Mi
|
||||||
|
limits:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 64Mi
|
||||||
|
ephemeral-storage: 10Mi
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
- name: {{ .Release.Name }}-{{ .Chart.Name }}-sfs
|
||||||
image: "l4rm4nd/vouchervault:{{ .Chart.AppVersion }}"
|
image: "l4rm4nd/vouchervault:{{ .Chart.AppVersion }}"
|
||||||
@@ -63,7 +90,15 @@ spec:
|
|||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.voucherVault.securityContext.container | nindent 12 }}
|
{{- toYaml .Values.voucherVault.securityContext.container | nindent 12 }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
{{- if .Values.voucherVault.storage.volumeMounts }}
|
# Writable emptyDirs over the paths the image writes at runtime,
|
||||||
|
# so the root filesystem can stay read-only (see securityContext
|
||||||
|
# in values.yaml).
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
- name: logs
|
||||||
|
mountPath: /opt/app/logs
|
||||||
|
- name: static-files
|
||||||
|
mountPath: /opt/app/myapp/static
|
||||||
{{- range $value := .Values.voucherVault.storage.volumeMounts }}
|
{{- range $value := .Values.voucherVault.storage.volumeMounts }}
|
||||||
- name: {{ tpl $value.name $ | quote }}
|
- name: {{ tpl $value.name $ | quote }}
|
||||||
mountPath: {{ tpl $value.mountPath $ | quote }}
|
mountPath: {{ tpl $value.mountPath $ | quote }}
|
||||||
@@ -77,12 +112,16 @@ spec:
|
|||||||
readOnly: {{ tpl $value.readOnly $ | quote }}
|
readOnly: {{ tpl $value.readOnly $ | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
|
||||||
[]
|
|
||||||
{{- end }}
|
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
volumes:
|
volumes:
|
||||||
{{- if .Values.voucherVault.storage.volumes }}
|
# Writable emptyDirs backing the read-only root filesystem (see
|
||||||
|
# securityContext in values.yaml).
|
||||||
|
- name: tmp
|
||||||
|
emptyDir: {}
|
||||||
|
- name: logs
|
||||||
|
emptyDir: {}
|
||||||
|
- name: static-files
|
||||||
|
emptyDir: {}
|
||||||
{{- range $value := .Values.voucherVault.storage.volumes }}
|
{{- range $value := .Values.voucherVault.storage.volumes }}
|
||||||
- name: {{ tpl $value.name $ | quote }}
|
- name: {{ tpl $value.name $ | quote }}
|
||||||
{{- if $value.persistentVolumeClaim }}
|
{{- if $value.persistentVolumeClaim }}
|
||||||
@@ -127,7 +166,4 @@ spec:
|
|||||||
sizeLimit: {{ tpl $value.emptyDir.sizeLimit $ | quote }}
|
sizeLimit: {{ tpl $value.emptyDir.sizeLimit $ | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
|
||||||
{{- else }}
|
|
||||||
[]
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -21,7 +21,10 @@ voucherVault:
|
|||||||
requests:
|
requests:
|
||||||
cpu: 0.1
|
cpu: 0.1
|
||||||
memory: 256Mi
|
memory: 256Mi
|
||||||
ephemeral-storage: 10Mi
|
# The static-files emptyDir (~90Mi of static assets, see the
|
||||||
|
# securityContext comment) counts toward the pod's ephemeral-storage
|
||||||
|
# usage, so the request must cover it.
|
||||||
|
ephemeral-storage: 128Mi
|
||||||
# "/" answers with a redirect for anonymous users, which httpGet treats as
|
# "/" answers with a redirect for anonymous users, which httpGet treats as
|
||||||
# success. The Host header must be set to 127.0.0.1 because Django's
|
# success. The Host header must be set to 127.0.0.1 because Django's
|
||||||
# ALLOWED_HOSTS only accepts 127.0.0.1 and the configured DOMAIN — probing
|
# ALLOWED_HOSTS only accepts 127.0.0.1 and the configured DOMAIN — probing
|
||||||
@@ -57,6 +60,13 @@ voucherVault:
|
|||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
failureThreshold: 30
|
failureThreshold: 30
|
||||||
|
# The upstream image (l4rm4nd/vouchervault) runs as www-data (uid/gid 33).
|
||||||
|
# With readOnlyRootFilesystem the chart mounts emptyDirs over the paths the
|
||||||
|
# image writes at runtime: /tmp (upload/PDF scratch files), /opt/app/logs
|
||||||
|
# and STATIC_ROOT /opt/app/myapp/static (the entrypoint runs collectstatic
|
||||||
|
# at every start; an init container seeds the volume with the static files
|
||||||
|
# shipped in the image, because the directory doubles as the app's static
|
||||||
|
# source). Uploads and the database live on the PVC at /opt/app/database.
|
||||||
securityContext:
|
securityContext:
|
||||||
pod:
|
pod:
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
@@ -66,7 +76,11 @@ voucherVault:
|
|||||||
fsGroupChangePolicy: Always
|
fsGroupChangePolicy: Always
|
||||||
container:
|
container:
|
||||||
allowPrivilegeEscalation: false
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
|
capabilities:
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
@@ -185,3 +199,7 @@ ingress:
|
|||||||
enabled: true
|
enabled: true
|
||||||
clusterIssuer: null
|
clusterIssuer: null
|
||||||
domain: null
|
domain: null
|
||||||
|
className: nginx
|
||||||
|
# Extra annotations for the Ingress; merged with the cert-manager
|
||||||
|
# cluster-issuer annotation the chart always sets.
|
||||||
|
annotations: {}
|
||||||
Reference in new issue
Block a user