Skip to content

Commit a0100f9

Browse files
committed
Switch to continuous logging during update.
We now have a continuous monitoring running in the background, so we just need to log the current step of the update and it will be logged. Depends-On: openstack-k8s-operators/ci-framework#2841 Resolves: [OSPRH-15060](https://issues.redhat.com/browse/OSPRH-15060)
1 parent faaca9f commit a0100f9

File tree

1 file changed

+13
-45
lines changed

1 file changed

+13
-45
lines changed

scripts/openstack-update.sh

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -43,45 +43,6 @@ else
4343
BASE_DIR="" # current directory
4444
fi
4545

46-
function get_current_compute_state {
47-
local stage="${1:-}"
48-
file_pre="${BASE_DIR}${stage:+${stage}-}"
49-
50-
if [ -e "${CI_INVENTORY}" ]; then
51-
echo "Collecting compute state ${stage:+for $stage }in ${BASE_DIR:-${PWD}}"
52-
53-
# Collect all running containers an all compute nodes in ~/ci-framework-data/tests/update/ by default.
54-
ansible -i "${CI_INVENTORY}" -m shell -a \
55-
"sudo podman ps -q --filter 'status=running' | xargs -I {} sudo podman inspect --format {% raw %} '{{.Name}} {{.Config.Image}} {{.State.StartedAt}}' {% endraw %} {}|sort" computes | \
56-
awk -vfile_pre="${file_pre}" 'BEGIN {tp=strftime("%Y%m%d%H%M%S")} /^compute/ {if (s != "") {close(s)}; s = "containers-" $1 "_" tp ".txt"; next;}; s {print > file_pre s} '
57-
# Collect packages list an all compute nodes in ~/ci-framework-data/tests/update/ by default.
58-
ansible -i "${CI_INVENTORY}" -m shell -a \
59-
"sudo dnf list installed | sort" computes | \
60-
awk -vfile_pre="${file_pre}" 'BEGIN {tp=strftime("%Y%m%d%H%M%S")} /^compute/ {if (s != "") {close(s)}; s = "packages-" $1 "_" tp ".txt"; next;}; s {print > file_pre s} '
61-
fi
62-
}
63-
64-
function get_current_pod_state {
65-
local stage="${1:-}"
66-
file_pre="${BASE_DIR}${stage:+${stage}-}"
67-
68-
echo "Collecting pod state ${stage:+for $stage }in ${BASE_DIR:-${PWD}}"
69-
70-
local openstack_state_file="${file_pre}pods_os_state_$(date +%Y%m%d_%H%M%S).tsv"
71-
local os_operator_state_file="${file_pre}pods_os_op_state_$(date +%Y%m%d_%H%M%S).tsv"
72-
oc get pods -n "${OPERATOR_NAMESPACE}" -o json | jq -r '.items[] | select(.status.phase == "Running") | . as $pod | .status.containerStatuses[] | [$pod.metadata.name, $pod.status.startTime, .image, .state.running.startedAt ] | @tsv' > $os_operator_state_file
73-
74-
oc get pods -n "${NAMESPACE}" -o json | jq -r '.items[] | select(.status.phase == "Running") | . as $pod | .status.containerStatuses[] | [$pod.metadata.name, $pod.status.startTime, .image, .state.running.startedAt ] | @tsv' > $openstack_state_file
75-
}
76-
77-
function get_current_state {
78-
local stage="${1:-}"
79-
get_current_compute_state "${stage}"
80-
get_current_pod_state "${stage}"
81-
}
82-
83-
get_current_state "01_before_update"
84-
8546
OPENSTACK_OPERATOR_CSV=$(oc get csv -n $OPERATOR_NAMESPACE -o name | grep openstack-operator)
8647
OPENSTACK_VERSION_CR=$(oc get openstackversion -n $NAMESPACE -o name)
8748

@@ -91,6 +52,8 @@ if [ "${FAKE_UPDATE}" != "false" ]; then
9152
OPENSTACK_DEPLOYED_VERSION=$(oc get -n $NAMESPACE $OPENSTACK_VERSION_CR --template={{.spec.targetVersion}})
9253
sed -i $OUTFILE -e "s|value: $OPENSTACK_DEPLOYED_VERSION|value: $OPENSTACK_VERSION|"
9354

55+
${UPDATE_ARTIFACT_DIR}/update_event.sh Applying Fake Update CR
56+
9457
oc apply -f $OUTFILE
9558
fi
9659

@@ -107,12 +70,14 @@ cat <<EOF >openstackversionpatch.yaml
10770
}
10871
EOF
10972

73+
${UPDATE_ARTIFACT_DIR}/update_event.sh Patching the Openstack Version
74+
11075
oc patch $OPENSTACK_VERSION_CR --type=merge --patch-file openstackversionpatch.yaml
11176

11277
# wait for ovn update on control plane
11378
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNControlplane --timeout=$TIMEOUT
11479

115-
get_current_state "02_after_ovn_controlplane_update"
80+
${UPDATE_ARTIFACT_DIR}/update_event.sh MinorUpdateOVNControlplane Completed
11681

11782
# start ovn update on data plane
11883
nodes_with_ovn=()
@@ -145,20 +110,22 @@ $OVN_NODE_SETS
145110
- ovn
146111
EOF
147112

113+
${UPDATE_ARTIFACT_DIR}/update_event.sh Applying the OVN CRD
114+
148115
oc create -f edpm-deployment-ovn-update.yaml
149116

150117
oc get openstackdataplanedeployment ${DATAPLANE_DEPLOYMENT}-ovn-update -o yaml
151118
# wait for ovn dataplane completes
152119
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNDataplane --timeout=$TIMEOUT
153120
echo "MinorUpdateOVNDataplane completed"
154121

155-
get_current_state "03_after_ovn_dataplane_update"
122+
${UPDATE_ARTIFACT_DIR}/update_event.sh MinorUpdateOVNDataplane Completed
156123

157124
# wait for control plane update to complete
158125
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateControlplane --timeout=$TIMEOUT
159-
echo "MinorUpdateControlplane completed"
160126

161-
get_current_state "04_after_controlplane_update"
127+
${UPDATE_ARTIFACT_DIR}/update_event.sh MinorUpdateControlplane Completed
128+
echo "MinorUpdateControlplane completed"
162129

163130
# start data plane plane update for rest of edpm services
164131
DATAPLANE_NODESETS=$(oc get openstackdataplanenodeset -o name | awk -F'/' '{print " - " $2}')
@@ -175,13 +142,14 @@ $DATAPLANE_NODESETS
175142
- update
176143
EOF
177144

145+
${UPDATE_ARTIFACT_DIR}/update_event.sh Applying the UPDATE CRD
146+
178147
oc create -f edpm-deployment-update.yaml
179148

180149
# wait for completion of minor update
181150
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateDataplane --timeout=$TIMEOUT
182151
echo "MinorUpdate completed"
183-
184-
get_current_state "05_after_update"
152+
${UPDATE_ARTIFACT_DIR}/update_event.sh MinorUpdateDataplane Completed
185153

186154
# check for the status of edpm update
187155
oc get openstackdataplanedeployment ${DATAPLANE_DEPLOYMENT}-update -o yaml

0 commit comments

Comments
 (0)