ansible-role-eom/tasks/git.yaml
2024-07-29 15:17:26 -04:00

109 lines
2.6 KiB
YAML

---
# tasks file for git
- name: Create persistent volume for git
k8s:
state: present
definition:
apiVersion: v1
kind: PersistentVolume
metadata:
name: "eom-{{ target_namespace }}-git"
spec:
capacity:
storage: 32Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: standard
hostPath:
path: "/data/store-0/eom/git"
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- alpha-worker-0
- name: Create a persistent volume claim for git
k8s:
state: present
definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: git
namespace: "eom-{{ target_namespace }}"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 32Gi
storageClassName: standard
volumeName: "eom-{{ target_namespace }}-git"
- name: Create a config map for httpd
k8s:
state: present
api_version: v1
kind: ConfigMap
name: git
namespace: "eom-{{ target_namespace }}"
definition:
data:
httpd.conf: "{{ lookup('template', 'git-httpd.conf.j2') }}"
- name: Create a deployment
k8s:
definition:
apiVersion: v1
kind: Deployment
metadata:
name: git
namespace: "eom-{{ target_namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: git
template:
metadata:
labels:
app: git
spec:
containers:
- name: cgit
image: invokr/cgit
volumeMounts:
- name: config
mountPath: /etc/httpd/conf
- name: data
mountPath: /var/www/htdocs/cgit
ports:
- containerPort: 80
volumes:
- name: config
configMap:
name: git
- name: data
persistentVolumeClaim:
claimName: git
- name: Expose deployment as a service
k8s:
definition:
apiVersion: v1
kind: Service
metadata:
name: git
namespace: "eom-{{ target_namespace }}"
spec:
selector:
app: git
ports:
- port: 80
name: git-80
type: ClusterIP