-
Notifications
You must be signed in to change notification settings - Fork 9
77 lines (69 loc) · 3.38 KB
/
deploy.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
name: Deploy
on:
push:
branches:
- 'main'
paths:
- 'deploy.md'
workflow_dispatch:
jobs:
Setup:
name: Setup OpenShift Installer Binary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Setup Working Directory for OCP Install
run: |
perl -pi -e 's/RED_HAT_PULLSECRET/${{ secrets.RED_HAT_PULLSECRET }}/' install-config.yaml
perl -pi -e 's/OCP_BASE_DOMAIN/${{ secrets.OCP_BASE_DOMAIN }}/' install-config.yaml
perl -pi -e 's/OCP_CLUSTER_NAME/${{ secrets.OCP_CLUSTER_NAME }}/' install-config.yaml
perl -pi -e 's/AWS_REGION/${{ secrets.AWS_REGION }}/' install-config.yaml
mkdir ocp-artifact
cp install-config.yaml ocp-artifact/
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
openshift-install: "${{secrets.OCP_CLIENT_VERSION}}"
oc: "${{secrets.OCP_CLIENT_VERSION}}"
- name: Get openshift-install flags
run: openshift-install create --help
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
- name: Create OpenShift Cluster
run: openshift-install create cluster --dir=ocp-artifact/
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
- name: Save Artifacts for Destroy
uses: actions/upload-artifact@v2
with:
name: ocp-artifact
path: ocp-artifact
- name: Setup HTPasswd IDP
run: |
export KUBECONFIG=ocp-artifact/auth/kubeconfig
echo "Creating htpasswd file"
htpasswd -c -b -B htpasswd ${{ secrets.OCP_ADMIN_USER }} ${{ secrets.OCP_ADMIN_PASS }}
htpasswd -b -B htpasswd ${{ secrets.OCP_DEV_USER }} ${{ secrets.OCP_DEV_PASS }}
oc create secret generic htpass-secret --from-file=htpasswd=htpasswd -n openshift-config --dry-run -o yaml | oc apply -f -
oc apply -f cluster-oauth.yaml
sleep 300
oc adm policy add-cluster-role-to-user cluster-admin ${{ secrets.OCP_ADMIN_USER }}
oc adm policy add-cluster-role-to-user cluster-admin -z openshift-gitops-argocd-application-controller
- name: Get Infra ID
run: |
export infraID=`cat ocp-artifact/metadata.json | jq -r .infraID`
export KUBECONFIG=ocp-artifact/auth/kubeconfig
perl -pi -e "s/{{ infraID }}/$infraID/g" infra-machineset.yaml
perl -pi -e 's/{{ regionID }}/${{ secrets.AWS_REGION }}/g' infra-machineset.yaml
perl -pi -e "s/{{ infraID }}/$infraID/g" infra-machineautoscaler.yaml
perl -pi -e 's/{{ regionID }}/${{ secrets.AWS_REGION }}/g' infra-machineautoscaler.yaml
perl -pi -e "s/{{ infraID }}/$infraID/g" worker-machineautoscaler.yaml
perl -pi -e 's/{{ regionID }}/${{ secrets.AWS_REGION }}/g' worker-machineautoscaler.yaml
oc create -f infra-machineset.yaml -n openshift-machine-api
oc create -f infra-machineautoscaler.yaml -n openshift-machine-api
oc create -f worker-machineautoscaler.yaml -n openshift-machine-api
oc create -f cluster-autoscaler.yaml