91 lines
1.8 KiB
YAML
91 lines
1.8 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/instance: estradiol-cloud
|
|
app.kubernetes.io/name: nginx
|
|
name: nginx-server-block
|
|
data:
|
|
default.conf: |-
|
|
server {
|
|
listen 80;
|
|
location / {
|
|
root /www/public;
|
|
index index.html;
|
|
}
|
|
}
|
|
---
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: nginx
|
|
labels:
|
|
app.kubernetes.io/instance: estradiol-cloud
|
|
app.kubernetes.io/name: nginx
|
|
spec:
|
|
containers:
|
|
- name: nginx
|
|
image: nginx:1.25.4
|
|
ports:
|
|
- containerPort: 80
|
|
name: http
|
|
volumeMounts:
|
|
- mountPath: /www
|
|
name: www
|
|
- mountPath: /etc/nginx/conf.d
|
|
name: nginx-server-block
|
|
- name: git-pull
|
|
image: bitnami/git
|
|
command:
|
|
- /bin/bash
|
|
- -ec
|
|
- |
|
|
while true; do
|
|
cd /www && git -c safe.directory=/www pull origin trunk
|
|
sleep 60
|
|
done
|
|
volumeMounts:
|
|
- mountPath: /www
|
|
name: www
|
|
initContainers:
|
|
- name: git-clone
|
|
image: bitnami/git
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- |
|
|
shopt -s dotglob
|
|
git clone https://code.estradiol.cloud/tamsin/estradiol.cloud.git --no-checkout --branch trunk /tmp/www;
|
|
cd /tmp/www;
|
|
git sparse-checkout init --cone;
|
|
git sparse-checkout set public;
|
|
git checkout;
|
|
mv /tmp/www/* /www
|
|
volumeMounts:
|
|
- mountPath: /www
|
|
name: www
|
|
volumes:
|
|
- name: www
|
|
emptyDir: {}
|
|
- name: nginx-server-block
|
|
configMap:
|
|
name: nginx-server-block
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/instance: estradiol-cloud
|
|
app.kubernetes.io/name: nginx
|
|
name: nginx
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app.kubernetes.io/instance: estradiol-cloud
|
|
app.kubernetes.io/name: nginx
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
protocol: TCP
|
|
targetPort: http
|