Run oidc insecure on unix socket using Nginx
Signed-off-by: Marco Franssen <[email protected]>
This commit is contained in:
@@ -40,11 +40,11 @@ spec:
|
|||||||
args:
|
args:
|
||||||
- -config
|
- -config
|
||||||
- /run/spire/oidc/config/oidc-discovery-provider.conf
|
- /run/spire/oidc/config/oidc-discovery-provider.conf
|
||||||
|
{{- if not .Values.oidc.allowInsecureScheme }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ .Values.oidc.service.port }}
|
|
||||||
name: http
|
|
||||||
- containerPort: 443
|
- containerPort: 443
|
||||||
name: https
|
name: https
|
||||||
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: spire-oidc-sockets
|
- name: spire-oidc-sockets
|
||||||
mountPath: /run/spire/oidc-sockets
|
mountPath: /run/spire/oidc-sockets
|
||||||
@@ -54,15 +54,34 @@ spec:
|
|||||||
readOnly: true
|
readOnly: true
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
exec:
|
exec:
|
||||||
command: ["/bin/ps", "aux", " ||", "grep", "oidc-discovery-provider -config /run/spire/oidc/config/oidc-discovery-provider.conf"]
|
command: ["/bin/ps", "aux", "|", "grep", "oidc-discovery-provider -config /run/spire/oidc/config/oidc-discovery-provider.conf"]
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
exec:
|
||||||
path: /.well-known/openid-configuration
|
command: ["/bin/ps", "aux", "|", "grep", "oidc-discovery-provider -config /run/spire/oidc/config/oidc-discovery-provider.conf"]
|
||||||
port: http
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 12 }}
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
{{- if .Values.oidc.allowInsecureScheme }}
|
||||||
|
- name: nginx
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: nginx:latest
|
||||||
|
imagePullPolicy: {{ .Values.oidc.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
name: http
|
||||||
|
volumeMounts:
|
||||||
|
- name: spire-oidc-sockets
|
||||||
|
mountPath: /run/spire/oidc-sockets
|
||||||
|
readOnly: true
|
||||||
|
- name: spire-oidc-config
|
||||||
|
mountPath: /etc/nginx/templates/default.conf.template
|
||||||
|
subPath: default.conf.template
|
||||||
|
readOnly: true
|
||||||
|
{{- end }}
|
||||||
volumes:
|
volumes:
|
||||||
- name: spire-oidc-sockets
|
- name: spire-oidc-sockets
|
||||||
hostPath:
|
hostPath:
|
||||||
|
|||||||
@@ -12,15 +12,36 @@ data:
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
domains = []
|
domains = []
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{- if .Values.oidc.allowInsecureScheme }}
|
||||||
allow_insecure_scheme = {{ .Values.oidc.allowInsecureScheme }}
|
allow_insecure_scheme = {{ .Values.oidc.allowInsecureScheme }}
|
||||||
|
listen_socket_path = "/run/spire/oidc-sockets/oidc-server.sock"
|
||||||
|
{{- else }}
|
||||||
acme {
|
acme {
|
||||||
directory_url = "{{ .Values.oidc.acme.directoryUrl }}"
|
directory_url = "{{ .Values.oidc.acme.directoryUrl }}"
|
||||||
cache_dir = "{{ .Values.oidc.acme.cacheDir }}"
|
cache_dir = "{{ .Values.oidc.acme.cacheDir }}"
|
||||||
tos_accepted = {{ .Values.oidc.acme.tosAccepted }}
|
tos_accepted = {{ .Values.oidc.acme.tosAccepted }}
|
||||||
email = "{{ .Values.oidc.acme.emailAddress }}"
|
email = "{{ .Values.oidc.acme.emailAddress }}"
|
||||||
}
|
}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
workload_api {
|
workload_api {
|
||||||
socket_path = "/run/spire/agent-sockets/agent.sock"
|
socket_path = "/run/spire/agent-sockets/agent.sock"
|
||||||
trust_domain = "{{ .Values.spire.trustDomain }}"
|
trust_domain = "{{ .Values.spire.trustDomain }}"
|
||||||
}
|
}
|
||||||
|
{{- if .Values.oidc.allowInsecureScheme }}
|
||||||
|
default.conf.template: |
|
||||||
|
upstream oidc {
|
||||||
|
server unix:/run/spire/oidc-sockets/oidc-server.sock;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://oidc;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{- end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -11,12 +11,15 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
type: {{ .Values.oidc.service.type }}
|
type: {{ .Values.oidc.service.type }}
|
||||||
ports:
|
ports:
|
||||||
|
{{- if .Values.oidc.allowInsecureScheme }}
|
||||||
- name: http
|
- name: http
|
||||||
port: {{ .Values.oidc.service.port }}
|
port: {{ .Values.oidc.service.port }}
|
||||||
targetPort: http
|
targetPort: http
|
||||||
|
{{- else }}
|
||||||
- name: https
|
- name: https
|
||||||
port: 443
|
port: 443
|
||||||
targetPort: https
|
targetPort: https
|
||||||
|
{{- end }}
|
||||||
selector:
|
selector:
|
||||||
{{- include "spire.oidc.selectorLabels" . | nindent 4 }}
|
{{- include "spire.oidc.selectorLabels" . | nindent 4 }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
Reference in New Issue
Block a user