Skip to content
New issue

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

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

Already on GitHub? # to your account

Add disable environment override option. #594

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

dpersson
Copy link
Contributor

@dpersson dpersson commented Jan 14, 2025

Sometimes you don't want to overwrite the provided arguments with possible settings from your environment variables.
This adds a flag to convert-kubeconfig for disabling environment override. It uses the flag in "kubelogin get-token" UpdateFromEnv() to return early and disregard possible setting of environment variables.

kubelogin convert-kubeconfig -l spn --client-id xxx --client-secret xxx --disable-environment-override

will result in:


{
  "name": "clusterxxx",
  "user": {
    "exec": {
      "apiVersion": "client.authentication.k8s.io/v1beta1",
      "args": [
        "get-token",
        "--login",
        "spn",
        "--server-id",
        "xxx",
        "--client-id",
        "***",
        "--tenant-id",
        "***",
        "--environment",
        "AzurePublicCloud",
        "--client-secret",
        "xxx",
        "--disable-environment-override"
      ],
      "command": "kubelogin",
      "env": null,
      "installHint": "\nkubelogin is not installed which is required to connect to AAD enabled cluster.\n\nTo learn more, please go to https://aka.ms/aks/kubelogin\n",
      "provideClusterInfo": false
    }
  }
}

Provides solution for #196

Add flag to convert-kubeconfig for allowing disabling environment override.
Use the flag in "kubelogin get-token" to disregard possible set environment variables.

Provides solution for Azure#196
@dpersson
Copy link
Contributor Author

@microsoft-github-policy-service agree

@microsoft-github-policy-service agree

Copy link
Contributor

@weinong weinong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@weinong weinong merged commit b852805 into Azure:main Jan 29, 2025
4 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants