Skip to content

Commit

Permalink
Change from Google OIDC to Azure OIDC
Browse files Browse the repository at this point in the history
  • Loading branch information
anuragprafulla committed May 14, 2024
1 parent a73014c commit 65324a5
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions setup-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ configure_helmfile_for_werf() {
}

install_kubelogin() {
brew install int128/kubelogin/kubelogin
brew install Azure/kubelogin/kubelogin
}

cluster_config() {
Expand All @@ -233,22 +233,19 @@ cluster_config() {
}

oidc_config() {
declare email="$1"
declare oidcIssuerUrl="$2"
declare oidcClientId="$3"
declare oidcClientSecret="$4"
declare serverId="$1"
declare clientId="$2"
declare tenantId="$3"

oidc_exists "$email" && return 0

kubectl config set-credentials "$email" \
kubectl config set-credentials azure_oidc \
--exec-api-version=client.authentication.k8s.io/v1beta1 \
--exec-command=kubectl \
--exec-arg=oidc-login \
--exec-command=kubelogin \
--exec-arg=get-token \
--exec-arg=--oidc-issuer-url="$oidcIssuerUrl" \
--exec-arg=--oidc-client-id="$oidcClientId" \
--exec-arg=--oidc-client-secret="$oidcClientSecret" \
--exec-arg=--oidc-extra-scope=email
--exec-arg=--server-id="$serverId" \
--exec-arg=--client-id="$clientId" \
--exec-arg=--tenant-id="$tenantId"
}

setup_tools() {
Expand Down Expand Up @@ -280,24 +277,24 @@ setup_tools_only() {
}

e2e() {
declare oidcIssuerUrl="$1"
declare oidcClientId="$2"
declare oidcClientSecret="$3"
declare serverId="$1"
declare clientId="$2"
declare tenantId="$3"
declare contextName="$4"
declare clusterName="$5"
declare clusterUrl="$6"
declare cadata="$7"
declare spinnakerHost="$8"
declare accessWebhook="$9"

confirm "Starting setup for devstack:${DOC_BASE}${DOC_TOOLS}${DOC_ACCESS}"

test_private_connection "https://${spinnakerHost}"
read_email email

setup_tools

oidc_config "$email" "$oidcIssuerUrl" "$oidcClientId" "$oidcClientSecret"
oidc_config "$serverId" "$clientId" "$tenantId"
cluster_config "$contextName" "$clusterName" "$clusterUrl" "$cadata" "$email"
spinnaker_webhook "$spinnakerHost" "$accessWebhook" "{\"user_email\": \"${email}\"}"

Expand Down

0 comments on commit 65324a5

Please sign in to comment.