Switch to non root nginx (#89)

This commit is contained in:
kfox1111
2023-03-04 15:43:03 +01:00
committed by GitHub
parent a901751ee7
commit 2e9510f3ad
4 changed files with 14 additions and 9 deletions
@@ -36,7 +36,7 @@ A Helm chart to install the SPIFFE OIDC discovery provider.
| insecureScheme.enabled | bool | `false` | | | insecureScheme.enabled | bool | `false` | |
| insecureScheme.nginx.image.pullPolicy | string | `"IfNotPresent"` | | | insecureScheme.nginx.image.pullPolicy | string | `"IfNotPresent"` | |
| insecureScheme.nginx.image.registry | string | `"docker.io"` | | | insecureScheme.nginx.image.registry | string | `"docker.io"` | |
| insecureScheme.nginx.image.repository | string | `"nginx"` | | | insecureScheme.nginx.image.repository | string | `"nginxinc/nginx-unprivileged"` | |
| insecureScheme.nginx.image.version | string | `"1.23.2-alpine"` | | | insecureScheme.nginx.image.version | string | `"1.23.2-alpine"` | |
| insecureScheme.nginx.resources | object | `{}` | | | insecureScheme.nginx.resources | object | `{}` | |
| nameOverride | string | `""` | | | nameOverride | string | `""` | |
@@ -40,14 +40,14 @@ data:
live_path = "/live" live_path = "/live"
} }
{{- if .Values.insecureScheme.enabled }} {{- if .Values.insecureScheme.enabled }}
default.conf.template: | default.conf: |
upstream oidc { upstream oidc {
server unix:{{ $oidcSocket }}; server unix:{{ $oidcSocket }};
} }
server { server {
listen 80; listen 8080;
listen [::]:80; listen [::]:8080;
location / { location / {
proxy_pass http://oidc; proxy_pass http://oidc;
@@ -77,16 +77,19 @@ spec:
image: {{ template "spiffe-oidc-discovery-provider.image" .Values.insecureScheme.nginx }} image: {{ template "spiffe-oidc-discovery-provider.image" .Values.insecureScheme.nginx }}
imagePullPolicy: {{ .Values.insecureScheme.nginx.image.pullPolicy }} imagePullPolicy: {{ .Values.insecureScheme.nginx.image.pullPolicy }}
ports: ports:
- containerPort: 80 - containerPort: 8080
name: http name: http
volumeMounts: volumeMounts:
- name: spire-oidc-sockets - name: spire-oidc-sockets
mountPath: /run/spire/oidc-sockets mountPath: /run/spire/oidc-sockets
readOnly: true readOnly: true
- name: spire-oidc-config - name: spire-oidc-config
mountPath: /etc/nginx/templates/default.conf.template mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf.template subPath: default.conf
readOnly: true readOnly: true
- name: nginx-tmp
mountPath: /tmp
readOnly: false
resources: resources:
{{- toYaml .Values.insecureScheme.nginx.resources | nindent 12 }} {{- toYaml .Values.insecureScheme.nginx.resources | nindent 12 }}
{{- if (dig "telemetry" "prometheus" "enabled" .Values.telemetry.prometheus.enabled .Values.global) }} {{- if (dig "telemetry" "prometheus" "enabled" .Values.telemetry.prometheus.enabled .Values.global) }}
@@ -96,7 +99,7 @@ spec:
image: {{ template "spiffe-oidc-discovery-provider.image" .Values.telemetry.prometheus.nginxExporter }} image: {{ template "spiffe-oidc-discovery-provider.image" .Values.telemetry.prometheus.nginxExporter }}
imagePullPolicy: {{ .Values.telemetry.prometheus.nginxExporter.image.pullPolicy }} imagePullPolicy: {{ .Values.telemetry.prometheus.nginxExporter.image.pullPolicy }}
args: args:
- -nginx.scrape-uri=http://127.0.0.1/stub_status - -nginx.scrape-uri=http://127.0.0.1:8080/stub_status
resources: resources:
{{- toYaml .Values.telemetry.prometheus.nginxExporter.resources | nindent 12 }} {{- toYaml .Values.telemetry.prometheus.nginxExporter.resources | nindent 12 }}
ports: ports:
@@ -114,6 +117,8 @@ spec:
- name: spire-oidc-config - name: spire-oidc-config
configMap: configMap:
name: {{ include "spiffe-oidc-discovery-provider.fullname" . }} name: {{ include "spiffe-oidc-discovery-provider.fullname" . }}
- name: nginx-tmp
emptyDir: {}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
@@ -49,7 +49,7 @@ insecureScheme:
nginx: nginx:
image: image:
registry: docker.io registry: docker.io
repository: nginx repository: nginxinc/nginx-unprivileged
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
version: 1.23.2-alpine version: 1.23.2-alpine
# chainguard image does not support the templates feature # chainguard image does not support the templates feature