Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions velero/schedule/common-service-db/cs-db-br-script-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ data:
oc apply -f /tmp/oidc-client-registration.yaml
rm -f /tmp/oidc-client-registration.yaml
wait_for_oidc

info "Restarting platform-auth-service..."
oc -n $CSDB_NAMESPACE delete pod -l app.kubernetes.io/instance=platform-auth-service
info "Wait for previous pod to delete..."
sleep 30
wait_for_auth_service
}

function wait_for_oidc {
Expand Down Expand Up @@ -146,6 +152,31 @@ data:
fi
}

function wait_for_auth_service {
info "Waiting for pod platform-auth-service to restart in namespace $CSDB_NAMESPACE."
deployment_exists=$(oc get deployment platform-auth-service -n $CSDB_NAMESPACE --no-headers || echo "fail")
if [[ $deployment_exists != "fail" ]]; then
replicas=$(oc get deployment platform-auth-service -n $CSDB_NAMESPACE --no-headers -o jsonpath='{.spec.replicas}')
ready_replicas=$(oc get deployment platform-auth-service -n $CSDB_NAMESPACE --no-headers -o jsonpath='{.status.readyReplicas}')
retry_count=60
while [[ "$replicas" != "$ready_replicas" ]] && [[ $retry_count > 0 ]]
do
info "Wait for pod platform-auth-service to complete. Try again in 5s."
sleep 5
completed=$(oc get job $job_name -n $CSDB_NAMESPACE --no-headers | awk '{print $2}')
retry_count=$((retry_count-1))
done

if [[ $retry_count == 0 ]] && [[ "$replicas" != "$ready_replicas" ]]; then
error "Timed out waiting for pod platform-auth-service."
else
info "Pod platform-auth-service restarted."
fi
else
error "Deployment platform-auth-service not exist."
fi
}

function wait_for_cluster_cr {
info "Waiting for EDB Cluster CR $CLUSTER_CR to complete in namespace $CSDB_NAMESPACE."
cluster_cr_exists=$(oc get clusters.postgresql.k8s.enterprisedb.io $CLUSTER_CR -n $CSDB_NAMESPACE --no-headers || echo fail)
Expand Down
1 change: 1 addition & 0 deletions velero/schedule/common-service-db/cs-db-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ rules:
- pods/status
- jobs
- secrets
- configmaps
- verbs:
- get
- list
Expand Down