Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change from Google OIDC to Azure OIDC #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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: 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
Loading