-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathdeployment.yaml
97 lines (97 loc) · 3.22 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{{- if .Values.staticWebsite.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: static-sites
spec:
replicas: 1
selector:
matchLabels:
app: static-sites
template:
metadata:
labels:
app: static-sites
annotations:
checksum/config: {{ include (print $.Template.BasePath "/static/configmap.yaml") . | sha256sum }}
spec:
volumes:
- name: config
configMap:
name: static-sites
- name: content
emptyDir: {}
{{- if .Values.staticWebsite.githubAuth.enabled }}
- name: git-config
secret:
secretName: static-sites
{{- end }}
initContainers:
- name: content-clone
image: quay.io/yuvipanda/git-credential-helpers:0.2
command:
- git
- clone
- --depth=1
- --branch={{ .Values.staticWebsite.source.git.branch | required "staticWebsite.source.git.branch is required with staticSite.enabled set to true" }}
- --single-branch
- --
- '{{ .Values.staticWebsite.source.git.repo | required "staticWebsite.source.git.repo is required with staticWebsite.enabled set to true" }}'
- /srv/content/repo
securityContext:
runAsUser: 1000
allowPrivilegeEscalation: False
readOnlyRootFilesystem: True
volumeMounts:
- name: content
mountPath: /srv/content
{{- if .Values.staticWebsite.githubAuth.enabled }}
- name: git-config
mountPath: /etc/gitconfig
subPath: gitconfig
readOnly: true
- name: git-config
mountPath: /etc/github/github-app-private-key.pem
subPath: github-app-private-key.pem
readOnly: true
{{- end }}
containers:
- name: content-sync
image: quay.io/yuvipanda/git-credential-helpers:0.2
workingDir: /srv/content
command:
- /bin/sh
args:
- -c
- "while true; do git fetch origin; git reset --hard origin/{{ .Values.staticWebsite.source.git.branch }}; sleep\
\ 5m; done"
securityContext:
runAsUser: 1000
allowPrivilegeEscalation: False
readOnlyRootFilesystem: True
volumeMounts:
- name: content
mountPath: /srv/content
{{- if .Values.staticWebsite.githubAuth.enabled }}
- name: git-config
mountPath: /etc/gitconfig
subPath: gitconfig
readOnly: true
- name: git-config
mountPath: /etc/github/github-app-private-key.pem
subPath: github-app-private-key.pem
readOnly: true
{{- end }}
- name: server
image: nginx:1.19
command: ["/usr/sbin/nginx", "-g", "daemon off;"]
ports:
- name: nginx
containerPort: 8080
volumeMounts:
- name: config
mountPath: /etc/nginx/conf.d/default.conf
subPath: nginx.conf
- name: content
mountPath: /srv/content
{{- end }}