-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vrt ]add basic auth proxy to api (#186)
* add auth proxy Signed-off-by: André Bauer <[email protected]> * readme Signed-off-by: André Bauer <[email protected]> * wording Signed-off-by: André Bauer <[email protected]> * cm Signed-off-by: André Bauer <[email protected]> * format Signed-off-by: André Bauer <[email protected]> * fix Signed-off-by: André Bauer <[email protected]> * info Signed-off-by: André Bauer <[email protected]> * try upgrad again Signed-off-by: André Bauer <[email protected]> --------- Signed-off-by: André Bauer <[email protected]>
- Loading branch information
Showing
14 changed files
with
289 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ check-version-increment: true | |
debug: true | ||
helm-extra-args: --timeout 600s | ||
target-branch: main | ||
upgrade: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
charts/visual-regression-tracker/templates/auth-proxy-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "visual-regression-tracker.fullname" . }}-auth | ||
labels: | ||
{{- include "visual-regression-tracker.labels" . | nindent 4 }} | ||
component: auth-proxy | ||
data: | ||
default.conf: | | ||
server { | ||
listen 8080; | ||
server_name _; | ||
location /health { | ||
return 200 'ok\n'; | ||
} | ||
location / { | ||
auth_basic "restricted"; | ||
auth_basic_user_file /tmp/htpass; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
proxy_set_header Host $host; | ||
proxy_pass "http://{{ include "visual-regression-tracker.fullname" . }}-api:4200"; | ||
proxy_http_version 1.1; | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
charts/visual-regression-tracker/templates/auth-proxy-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "visual-regression-tracker.fullname" . }}-auth | ||
labels: | ||
{{- include "visual-regression-tracker.labels" . | nindent 4 }} | ||
component: auth-proxy | ||
spec: | ||
replicas: {{ .Values.authProxy.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "visual-regression-tracker.selectorLabels" . | nindent 6 }} | ||
component: auth-proxy | ||
template: | ||
metadata: | ||
{{- with .Values.authProxy.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "visual-regression-tracker.labels" . | nindent 8 }} | ||
{{- with .Values.authProxy.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
component: auth-proxy | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "visual-regression-tracker.serviceAccountName" . }} | ||
initContainers: | ||
- name: create-basic-auth | ||
command: | ||
- htpasswd | ||
- -b | ||
- -c | ||
- /tmp/htpass | ||
- {{ .Values.authProxy.basicAuth.username }} | ||
- $(AUTH_SECRET) | ||
env: | ||
- name: AUTH_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ template "visual-regression-tracker.authProxySecretName" . }} | ||
key: {{ .Values.secrets.authProxy.secretKey }} | ||
securityContext: | ||
{{- toYaml .Values.authProxy.initContainer.securityContext | nindent 12 }} | ||
image: "{{ .Values.authProxy.initContainer.image.repository }}:{{ .Values.authProxy.initContainer.image.tag }}" | ||
imagePullPolicy: {{ .Values.authProxy.image.pullPolicy }} | ||
resources: | ||
{{- toYaml .Values.authProxy.initContainer.resources | nindent 12 }} | ||
volumeMounts: | ||
- mountPath: /tmp | ||
name: tmpdir | ||
containers: | ||
- name: auth-proxy | ||
securityContext: | ||
{{- toYaml .Values.authProxy.securityContext | nindent 12 }} | ||
image: "{{ .Values.authProxy.image.repository }}:{{ .Values.authProxy.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.authProxy.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.authProxy.service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8080 | ||
failureThreshold: 10 | ||
readinessProbe: | ||
httpGet: | ||
path: /health | ||
port: 8080 | ||
failureThreshold: 3 | ||
resources: | ||
{{- toYaml .Values.authProxy.resources | nindent 12 }} | ||
volumeMounts: | ||
- mountPath: /tmp | ||
name: tmpdir | ||
- name: auth | ||
mountPath: /etc/nginx/conf.d/default.conf | ||
subPath: default.conf | ||
readOnly: true | ||
volumes: | ||
- name: tmpdir | ||
emptyDir: | ||
sizeLimit: {{ .Values.authProxy.tmpDirSizeLimit }} | ||
- name: auth | ||
configMap: | ||
defaultMode: 420 | ||
name: {{ include "visual-regression-tracker.fullname" . }}-auth | ||
{{- with .Values.authProxy.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.authProxy.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.authProxy.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
charts/visual-regression-tracker/templates/auth-proxy-secret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{ if and .Values.authProxy.basicAuth.password (not .Values.secrets.authProxy.useExisting) }} | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "visual-regression-tracker.fullname" . }}-auth | ||
labels: | ||
{{- include "visual-regression-tracker.labels" . | nindent 4 }} | ||
component: auth-proxy | ||
type: Opaque | ||
data: | ||
{{ .Values.secrets.authProxy.secretKey }}: {{ .Values.authProxy.basicAuth.password | b64enc | quote }} | ||
{{ end }} |
17 changes: 17 additions & 0 deletions
17
charts/visual-regression-tracker/templates/auth-proxy-service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "visual-regression-tracker.fullname" . }}-auth | ||
labels: | ||
{{- include "visual-regression-tracker.labels" . | nindent 4 }} | ||
component: auth-proxy | ||
spec: | ||
type: {{ .Values.authProxy.service.type }} | ||
ports: | ||
- port: {{ .Values.authProxy.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "visual-regression-tracker.selectorLabels" . | nindent 4 }} | ||
component: auth-proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.