Skip to content

Commit

Permalink
Managed CSC controller: wait time updated
Browse files Browse the repository at this point in the history
  • Loading branch information
shavi2626 committed Jan 30, 2025
1 parent 44a292e commit 47784bc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
23 changes: 13 additions & 10 deletions asmcli/asmcli

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions asmcli/commands/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,16 @@ install_canonical_controller() {
}

install_managed_canonical_controller() {
local IN_CLUSTER_CSC_DEP="$(kubectl get deployment/canonical-service-controller-manager -n asm-system --ignore-not-found=true || true)"
info "Installing managed caonical service controller..."
local IN_CLUSTER_CSC_DEP="$(kubectl get deployment/canonical-service-controller-manager \
-n asm-system --ignore-not-found=true || true)"
if [[ -z "$IN_CLUSTER_CSC_DEP" ]]; then
# In-cluster canonical service controller present
warn "Kindly migrate to managed canonical service controller. Refer <Doc>"
else
enable_service_mesh_feature
if ! is_service_mesh_feature_enabled; then
enable_service_mesh_feature
fi
check_managed_canonical_controller_state
else
warn "Kindly migrate to managed canonical service controller. Refer <Doc>"
fi
}

Expand Down
10 changes: 5 additions & 5 deletions asmcli/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -863,25 +863,25 @@ check_managed_canonical_controller_state() {

local CSC_STATUS_AVAILABLE=0
local CS_ERROR="CANONICAL_SERVICE_ERROR"
local MEMBERSHIP_STATE,CODE, CONDITIONS
local MEMBERSHIP_STATE;
local CODE;

for i in {1..3}; do
for i in {1..5}; do
MEMBERSHIP_STATE=$( gcloud container fleet mesh describe --project "${FLEET_ID}" --format=json | \
jq '.membershipStates | with_entries(select(.key|test("'"${MEMBERSHIP_NAME}"'")))[]' )
CODE=$( jq -r '.state.code' <<< "$MEMBERSHIP_STATE" )
if [ "$CODE" = "OK" ]; then
info "Managed Canonical Service Controller working successfully"
CSC_STATUS_AVAILABLE=1; break
elif [ "$CODE" = "WARNING" ]; then
CONDITIONS=$( jq -r '.servicemesh.conditions' <<< "$MEMBERSHIP_STATE" )
if grep -q "$CS_ERROR" <<< "$CONDITIONS"; then
if jq -r '.servicemesh.conditions | contains("'$CS_ERROR'")' <<< "$MEMBERSHIP_STATE" | grep -q true; then
warn "Managed Canonical Service Controller facing issues. Kindly refer to <wiki link>"
CSC_STATUS_AVAILABLE=1
fi
break
else
echo "Retry to get featureState.code for the membership: $MEMBERSHIP_NAME"
sleep 3
sleep 60
fi
done

Expand Down

0 comments on commit 47784bc

Please sign in to comment.