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

Add --kubeconfig flag for out-of-cluster auth #2081

Merged

Conversation

cartermckinnon
Copy link
Contributor

@cartermckinnon cartermckinnon commented Jul 4, 2024

Is this a bug fix or adding new feature?

Feature

What is this PR about? / Why do we need it?

This adds a command-line flag, --kubeconfig, that allows an alternative to rest.InClusterConfig(). This is useful when running the CSI driver outside of a Pod.

If --kubeconfig is empty, the behavior is unchanged.

What testing is done?

I see the k8s client instantiated successfully:

> CSI_NODE_NAME=ip-192-168-69-200.us-west-2.compute.internal bin/aws-ebs-csi-driver --kubeconfig ~/.kube/config

I0704 00:50:11.709966   21408 main.go:157] "Initializing metadata"
I0704 00:50:11.710049   21408 metadata.go:66] "The AWS_EC2_METADATA_DISABLED environment variable disables access to EC2 IMDS" enabled="true"
E0704 00:50:11.710363   21408 metadata.go:51] "Retrieving IMDS metadata failed, falling back to Kubernetes metadata" err="could not get EC2 instance identity metadata: operation error ec2imds: GetInstanceIdentityDocument, access disabled to EC2 IMDS via client option, or \"AWS_EC2_METADATA_DISABLED\" environment variable"
I0704 00:50:12.535331   21408 metadata.go:55] "Retrieved metadata from Kubernetes"

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 4, 2024
Copy link
Contributor

@ConnorJC3 ConnorJC3 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 8, 2024
Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: torredil

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 8, 2024
@cartermckinnon
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit a789247 into kubernetes-sigs:master Jul 8, 2024
19 checks passed
@cartermckinnon cartermckinnon deleted the add-kubeconfig-flag branch July 8, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants