@@ -67,4 +67,150 @@ Subpath prefix value to use for pvc mount points
6767{ {- define " mkdocs-material.subpathPrefix" -} }
6868{ {- $path := default (include " mkdocs-material.fullname" .) .Values.storage.overrideSubpathPrefix -} }
6969{ {- ternary ($path | printf " %s/" ) " " .Values.storage.existingSubpathPrefix -} }
70- { {- end } }
70+ { {- end } }
71+
72+ { {/*
73+ Shared yaml for the git containers
74+ */} }
75+ { {- define " mkdocs-material.git-container" } }
76+ { {- if .Values.giturl } }
77+ - name: git-pull
78+ image: "bitnami/git"
79+ command: ["/entry.d/git-pull.sh"]
80+ env:
81+ - name: DOCS_GIT_URL
82+ value: { { (tpl .Values.giturl .) } }
83+ - name: DOCS_GIT_BRANCH
84+ value: { { .Values.gitbranch } }
85+ { {- if .Values.gitCredentialsSecret } }
86+ - name: DOCS_GIT_CRED_FILE
87+ value: { { default " .git-credentials" .Values.gitCredentialsSecretKey } }
88+ { {- end } }
89+ { {- if .Values.gitPath } }
90+ - name: DOCS_GIT_PATH
91+ value: { { .Values.gitPath | trimPrefix " /" } }
92+ { {- end } }
93+ { {- if .Values.mkdocs.site_url } }
94+ - name: DOCS_SITE_URL
95+ value: { { .Values.mkdocs.site_url } }
96+ { {- end } }
97+ volumeMounts:
98+ - mountPath: /entry.d
99+ name: { { include " mkdocs-material.fullname" . } }-entry
100+ - mountPath: /docs
101+ name: { { include " mkdocs-material.fullname" . } }-vol
102+ subPath: { { include " mkdocs-material.subpathPrefix" . } }docs
103+ - mountPath: /git
104+ name: { { include " mkdocs-material.fullname" . } }-vol
105+ subPath: { { include " mkdocs-material.subpathPrefix" . } }git
106+ { {- if .Values.gitCredentialsSecret } }
107+ - mountPath: /git-credentials
108+ name: { { include " mkdocs-material.fullname" . } }-git-creds
109+ { {- end } }
110+ { {- if or .Values.certificateMap .Values.cacert } }
111+ - mountPath: /usr/local/share/ca-certificates
112+ name: certificates
113+ { {- end } }
114+ { {- end } }
115+ { {- end } }
116+
117+ { {/*
118+ Shared yaml for the mkdocs containers
119+ */} }
120+ { {- define " mkdocs-material.mkdocs-container" } }
121+ - name: mkdocs-build
122+ image: "{ { .Values.image.repository } }:{ { .Values.image.tag | default .Chart.AppVersion } }"
123+ imagePullPolicy: { { .Values.image.pullPolicy } }
124+ { {- if .Values.giturl } }
125+ command: ["/entry.d/mkdocs-build.sh"]
126+ { {- else } }
127+ args: ["build"]
128+ { {- end } }
129+ env:
130+ - name: MKDOCS_ADD_MACROS
131+ value: { { default " false" .Values.macrosPlugin.enabled | toString | quote } }
132+ - name: MKDOCS_MACROS_VERSION
133+ value: { { default " 1.3.9" .Values.macrosPlugin.version | toString | quote } }
134+ { {- if .Values.gitPath } }
135+ - name: DOCS_GIT_PATH
136+ value: { { .Values.gitPath | trimPrefix " /" } }
137+ { {- end } }
138+ volumeMounts:
139+ { {- if and .Values.macrosPlugin.enabled .Values.macrosPlugin.extraYamlConfig } }
140+ - mountPath: { { default " /mkdocs-vars" .Values.macrosPlugin.extraYamlConfigMount } }
141+ name: { { include " mkdocs-material.fullname" . } }-macro-vars
142+ { {- end } }
143+ { {- if .Values.giturl } }
144+ - mountPath: /entry.d
145+ name: { { include " mkdocs-material.fullname" . } }-entry
146+ - mountPath: /docs
147+ name: { { include " mkdocs-material.fullname" . } }-vol
148+ subPath: { { include " mkdocs-material.subpathPrefix" . } }docs
149+ - mountPath: /git
150+ name: { { include " mkdocs-material.fullname" . } }-vol
151+ subPath: { { include " mkdocs-material.subpathPrefix" . } }git
152+ { {- else } }
153+ - mountPath: /docs/mkdocs.yml
154+ name: { { include " mkdocs-material.fullname" . } }
155+ subPath: mkdocs.yml
156+ - mountPath: /docs/docs
157+ name: { { include " mkdocs-material.fullname" . } }-files
158+ - mountPath: /docs/site
159+ name: { { include " mkdocs-material.fullname" . } }-vol
160+ subPath: { { include " mkdocs-material.subpathPrefix" . } }docs/site
161+ { {- end } }
162+ { {- end } }
163+
164+ { {/*
165+ Shared yaml for the volumes
166+ */} }
167+ { {- define " mkdocs-material.container-volumes" } }
168+ - name: { { include " mkdocs-material.fullname" . } }
169+ configMap:
170+ name: { { include " mkdocs-material.fullname" . } }
171+ { {- if .Values.giturl } }
172+ - name: { { include " mkdocs-material.fullname" . } }-entry
173+ configMap:
174+ name: { { include " mkdocs-material.fullname" . } }-entry
175+ defaultMode: 0775
176+ { {- if .Values.gitCredentialsSecret } }
177+ - name: { { include " mkdocs-material.fullname" . } }-git-creds
178+ secret:
179+ secretName: { { .Values.gitCredentialsSecret } }
180+ defaultMode: 0600
181+ { {- end } }
182+ { {- else } }
183+ - name: { { include " mkdocs-material.fullname" . } }-files
184+ configMap:
185+ name: { { include " mkdocs-material.fullname" . } }-files
186+ { {- end } }
187+ { {- if .Values.storage.existing } }
188+ - name: { { include " mkdocs-material.fullname" . } }-vol
189+ persistentVolumeClaim:
190+ claimName: { { .Values.storage.existing } }
191+ { {- else if .Values.storage.size } }
192+ - name: { { include " mkdocs-material.fullname" . } }-vol
193+ persistentVolumeClaim:
194+ claimName: { { include " mkdocs-material.fullname" . } }
195+ { {- else if .Values.giturl } }
196+ { {- fail " Git deployment mode requires persistent volume" } }
197+ { {- else } }
198+ - name: { { include " mkdocs-material.fullname" . } }-vol
199+ emptyDir: { }
200+ { {- end } }
201+ { {- if .Values.certificateMap } }
202+ - name: certificates
203+ configMap:
204+ name: { { .Values.certificateMap } }
205+ { {- end } }
206+ { {- if .Values.cacert } }
207+ - name: certificates
208+ configMap:
209+ name: { { include " mkdocs-material.fullname" . } }-cacerts
210+ { {- end } }
211+ { {- if and .Values.macrosPlugin.enabled .Values.macrosPlugin.extraYamlConfig } }
212+ - name: { { include " mkdocs-material.fullname" . } }-macro-vars
213+ configMap:
214+ name: { { include " mkdocs-material.fullname" . } }-macro-vars
215+ { {- end } }
216+ { {- end } }
0 commit comments