iits-consulting / otc-auth

Open Source CLI for the Open Telekom Cloud written in go.
GNU General Public License v3.0
44 stars 5 forks source link

create-kube-config command doesn't automatically request a scoped token #10

Closed jotabe87 closed 1 year ago

jotabe87 commented 1 year ago

When getting a kube config from the otc using the create-kube-config command it won't automatically request a scoped token if one isn't available for the current project.

In kube-config.go:

func getKubeConfig(kubeConfigParams KubeConfigParams) string {
    //  check for scoped token before this call
    response := getClusterCertFromServiceProvider(kubeConfigParams.ProjectName, clusterId, kubeConfigParams.DaysValid)
}

The scoped token should be available before the call in the getClusterCertFromServiceProvider function:

func getClusterCertFromServiceProvider(projectName string, clusterId string, duration string) (response *http.Response) {
    // project.ScopedToken should not be empty here
    request.Header.Add(xheaders.XAuthToken, project.ScopedToken.Secret)
}
victorgetz commented 1 year ago

I could not reproduce this error.

My commands

rm ~/.otc-auth-config otc-auth login idp-oidc otc-auth cce get-kube-config -c ...

worked like a charm

bbung commented 1 year ago

I also cannot reproduce this error with the latest version. Seems fixed.

jotabe87 commented 1 year ago

The latest release has somehow a loop that requests a scoped token on the first login

image

Other than that the issue seems to be closed. I'll open another issue for this behavior.