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

fix windows command in the token application #114

Open
vrabbi opened this issue Jun 6, 2024 · 0 comments
Open

fix windows command in the token application #114

vrabbi opened this issue Jun 6, 2024 · 0 comments

Comments

@vrabbi
Copy link

vrabbi commented Jun 6, 2024

the windows command for configuring the kube context has an issue. it misconfigures the CA as it is using UTF8-BOM which adds weird characters at the front of the string.

this can be fixed by changing the following snippet from:

out-file \$TMP_CERT -encoding oem 

to:

set-content -path $TMP_CERT -encoding utf8

making the final config:

\$TMP_CERT=New-TemporaryFile ; "$k8s_newline_cert_win$" | set-content -path \$TMP_CERT -encoding utf8 ; kubectl config set-cluster #[K8S_CLUSTER_NAME:kubernetes] --server=#[K8S_URL]  --certificate-authority=\$TMP_CERT --embed-certs=true ; kubectl config set-context #[K8S_CLUSTER_NAME:kubernetes] --cluster=#[K8S_CLUSTER_NAME:kubernetes] --user=$user_id$@#[K8S_CLUSTER_NAME:kubernetes]  ; kubectl config set-credentials $user_id$@#[K8S_CLUSTER_NAME:kubernetes]  --auth-provider=oidc --auth-provider-arg=client-secret= --auth-provider-arg=idp-issuer-url=$token.claims.issuer$ --auth-provider-arg=client-id=$token.trustName$ --auth-provider-arg=refresh-token=$token.refreshToken$  --auth-provider-arg=id-token=$token.encodedIdJSON$  --auth-provider-arg=idp-certificate-authority-data=$ou_b64_cert$ ; kubectl config use-context #[K8S_CLUSTER_NAME:kubernetes] ; Remove-Item -recurse -force \$TMP_CERT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant