Files
homelab/cluster-config/clusters/overlays/local.hub/components/quay-registry-operator/init-quay-job.yaml

84 lines
2.4 KiB
YAML

apiVersion: v1
kind: ServiceAccount
metadata:
name: quay-init
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: quay-init
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: admin
subjects:
- kind: ServiceAccount
name: quay-init
---
apiVersion: batch/v1
kind: Job
metadata:
name: quay-init
annotations:
argocd.argoproj.io/sync-wave: "20"
spec:
template:
spec:
containers:
- image: registry.redhat.io/ansible-automation-platform-21/ee-supported-rhel8:1.0
envFrom:
- secretRef:
name: init-user-password
command:
- /bin/bash
- -c
- |
#!/usr/bin/env bash
echo "Setup temporary OCP user to make ansible happy"
echo "tempuser:x:$(id -u):$(id -g):,,,:${HOME}:/bin/bash" >> /etc/passwd
echo "tempuser:x:$(id -G | cut -d' ' -f 2)" >> /etc/group
id
echo "Waiting for two minutes for quay to be ready"
sleep 120
git clone https://github.com/gnunn-gitops/quay-init
cd quay-init
ansible-galaxy collection install -r collections/requirements.yaml
ansible-playbook quay-init.yaml -e quay_init_password=$quay_init_password -e ansible_remote_tmp=/tmp
echo "Waiting for deploy/registry-clair-app to be available"
until oc get deployment registry-clair-app
do
sleep 5;
done
oc scale deploy/registry-clair-app --replicas=1
echo "Waiting for deploy/registry-quay-app to be available"
until oc get deployment registry-quay-app
do
sleep 5;
done
oc set resources deploy/registry-quay-app -c=quay-app --requests=cpu=1,memory=1Gi --limits=cpu=2,memory=4Gi
oc scale deploy/registry-quay-app --replicas=1
echo "Waiting for deploy/registry-clair-postgres to be available"
until oc get deployment registry-clair-postgres
do
sleep 5;
done
oc set resources deploy/registry-clair-postgres -c=postgres --limits=memory=3Gi
name: init-quay
dnsPolicy: ClusterFirst
restartPolicy: Never
terminationGracePeriodSeconds: 30
serviceAccount: quay-init
serviceAccountName: quay-init