-
Notifications
You must be signed in to change notification settings - Fork 51
142 lines (117 loc) · 6.07 KB
/
upgrade-test.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: DSP Upgrade Testing Workflow
on:
workflow_dispatch:
inputs:
released-version:
default: 'v1.y.y'
description: 'Most recently released DSP version'
required: true
candidate-version:
default: 'v1.x.x'
description: 'Candidate version for upgrade'
required: true
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
dspo-upgrade:
runs-on: ubuntu-20.04
timeout-minutes: 60
env:
OLM_VERSION: v0.24.0
VERSION: "v0.0.0-ghaction" # Need to supply some semver version for bundle to be properly generated
CATALOG_BASE_IMG: "registry.access.redhat.com/redhat/community-operator-index:v4.13"
RESOURCES_DIR: ${{ github.workspace }}/.github/resources
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching also previous commits to get tags
- name: Setup and start KinD cluster
uses: ./.github/actions/kind
- name: Install OLM
run: |
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/crds.yaml
# wait for a while to be sure CRDs are installed
sleep 1
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/olm.yaml
echo Wait for default CatalogSource to start
kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=180s
env:
CATALOG_SOURCE_NAME: "operatorhubio-catalog"
CATALOG_SOURCE_NAMESPACE: "olm"
- name: Create openshift-operator namespace and OperatorGroup
run: |
kubectl create namespace openshift-operators
kubectl create -f ${{ env.RESOURCES_DIR }}/olm/operatorgroup.yaml
- name: Apply CRDs
run: |
kubectl apply -f ${{ env.RESOURCES_DIR }}/crds
- name: Deploy latest released OpenDataHub operator from OLM
id: deploy
run: |
echo Deploying operator using Subscription
envsubst < ${{ env.RESOURCES_DIR }}/olm/catalogsource.yaml > ${{ env.TEMP_DIR }}/catalogsource.yaml
envsubst < ${{ env.RESOURCES_DIR }}/olm/subscription.yaml > ${{ env.TEMP_DIR }}/subscription.yaml
kubectl create -f ${{ env.TEMP_DIR }}/catalogsource.yaml
echo Wait for CatalogSource ${{ env.CATALOG_SOURCE_NAME }} to start
kubectl wait -n ${{ env.CATALOG_SOURCE_NAMESPACE }} catalogsource/${{ env.CATALOG_SOURCE_NAME }} --for=jsonpath='{.status.connectionState.lastObservedState}'=READY --timeout=300s
kubectl create -f ${{ env.TEMP_DIR }}/subscription.yaml
echo Waiting for Subscription to be ready
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} subscription/${{ env.SUBSCRIPTION_NAME }} --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s
echo Waiting for Deployment to be ready
timeout 60 bash -c 'until [[ $(kubectl get deployment/opendatahub-operator-controller-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}') ]]; do sleep 5 && echo "$(kubectl get deployment/opendatahub-operator-controller-manager -n '${{ env.SUBSCRIPTION_NAMESPACE }}')"; done'
kubectl wait -n ${{ env.SUBSCRIPTION_NAMESPACE }} deployment/opendatahub-operator-controller-manager --for=condition=Available=true --timeout=60s
env:
CATALOG_SOURCE_NAME: "odh-olm-test"
CATALOG_SOURCE_NAMESPACE: "olm"
SUBSCRIPTION_NAME: "opendatahub-operator"
SUBSCRIPTION_NAMESPACE: "openshift-operators"
- name: Create Namespace for DSPO
run: |
kubectl create namespace ${{ env.DSPO_NS }}
kubectl config set-context --current --namespace=${{ env.DSPO_NS }}
env:
DSPO_NS: data-science-pipelines-operator
- name: Prepare for Upgrade Testing
run: |
# Update the KfDef manifest with the latest released version
sed -i "s/main/${{ inputs.released-version }}/" ${{ env.RESOURCES_DIR }}/kfdef/kfdef.yaml
working-directory: ${{ env.RESOURCES_DIR }}/kfdef
- name: Print KfDef Manifest Contents
run: cat ${{ env.RESOURCES_DIR }}/kfdef/kfdef.yaml
- name: Deploy DSPO KfDef
run: |
kubectl apply -f ${{ env.RESOURCES_DIR }}/kfdef/kfdef.yaml -n ${{ env.DSPO_NS }}
env:
DSPO_NS: "data-science-pipelines-operator"
- name: Print ODH Operator Pod Logs
run: kubectl get pods -n openshift-operators -o jsonpath='{.items[*].metadata.name}' | xargs -I {} kubectl logs -n openshift-operators {}
- name: Wait for DSPO deployment to be ready
run: |
kubectl get deployments -n ${{ env.DSPO_NS }}
timeout 300 bash -c 'until [[ $(kubectl get deployment/data-science-pipelines-operator-controller-manager -n '${{ env.DSPO_NS }}') ]]; do sleep 5 && echo "$(kubectl get deployment/data-science-pipelines-operator-controller-manager -n '${{ env.DSPO_NS }}')"; done'
env:
DSPO_NS: data-science-pipelines-operator
- name: Run pre-upgrade tests
run: |
./tests/upgrades/main.sh
env:
DSPA_NS: test-ds-project-1
WORKING_DIR: ${{ github.workspace }}
- name: Prepare for Upgrade Testing
run: |
# Update the KfDef manifest with the candidate version
sed -i "s/${{ inputs.released-version }}/${{ inputs.candidate-version }}/" ${{ env.RESOURCES_DIR }}/kfdef/kfdef.yaml
working-directory: ${{ env.RESOURCES_DIR }}/kfdef
- name: Print KfDef Manifest Contents
run: cat ${{ env.RESOURCES_DIR }}/kfdef/kfdef.yaml
- name: Deploy KfDef Core for the candidate DSP Version
run: |
kubectl apply -f ${{ env.RESOURCES_DIR }}/kfdef/kfdef.yaml -n ${{ env.DSPO_NS }}
env:
DSPO_NS: data-science-pipelines-operator
- name: Run upgrade tests
run: |
./tests/upgrades/main.sh
env:
DSPA_NS: test-ds-project-2