Skip to content

Commit

Permalink
refactored and update in-cluster CS controller incase of existing dep…
Browse files Browse the repository at this point in the history
…loyment
  • Loading branch information
shavi2626 committed Feb 12, 2025
1 parent 64eb7f8 commit f8e82a2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 36 deletions.
31 changes: 13 additions & 18 deletions asmcli/asmcli

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

24 changes: 10 additions & 14 deletions asmcli/commands/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,21 @@ apply_kube_yamls() {
done
}

install_canonical_controller() {
info "Installing ASM CanonicalService controller in asm-system namespace..."
retry 3 kubectl apply -f "${CANONICAL_CONTROLLER_MANIFEST}"
info "Waiting for deployment..."
retry 3 kubectl wait --for=condition=available --timeout=600s \
deployment/canonical-service-controller-manager -n asm-system
info "...done!"
}

install_managed_canonical_controller() {
info "Installing managed canonical service controller..."
verify_canonical_controller() {
local IN_CLUSTER_CSC_DEP; IN_CLUSTER_CSC_DEP="$(kubectl get deployment/canonical-service-controller-manager \
-n asm-system --ignore-not-found=true || true)"
-n asm-system --ignore-not-found=true || true)"
if [[ -z "$IN_CLUSTER_CSC_DEP" ]]; then
enable_service_mesh_feature
info "Checking Managed CanonicalService controller state..."
check_managed_canonical_controller_state
else
warn "Kindly migrate to managed canonical service controller. Refer <DocLink to be added>"
info "Updating ASM CanonicalService controller in asm-system namespace..."
retry 3 kubectl apply -f "${CANONICAL_CONTROLLER_MANIFEST}"
info "Waiting for deployment..."
retry 3 kubectl wait --for=condition=available --timeout=600s \
deployment/canonical-service-controller-manager -n asm-system
fi
info "...done!"
}

install_fleet_api() {
Expand Down Expand Up @@ -278,5 +274,5 @@ install_control_plane() {
if use_fleet_api; then install_fleet_api; else install_control_plane_revision; fi
fi

install_managed_canonical_controller
verify_canonical_controller
}
7 changes: 3 additions & 4 deletions asmcli/commands/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ validate_dependencies() {
if ! is_stackdriver_enabled; then
enable_stackdriver_kubernetes
fi
if needs_service_mesh_feature; then
enable_service_mesh_feature
fi
enable_service_mesh_feature
if [[ "${CA}" == "managed_cas" ]]; then
x_wait_for_gke_hub_api_enablement
x_enable_workload_certificate_on_fleet "gkehub.googleapis.com"
Expand All @@ -64,8 +62,9 @@ validate_dependencies() {
exit_if_service_mesh_feature_not_enabled
fi
fi
else
enable_service_mesh_feature
fi

if can_register_cluster; then
register_cluster
exit_if_cluster_unregistered
Expand Down

0 comments on commit f8e82a2

Please sign in to comment.