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 Kubernetes client auth exec config support #506

Merged
merged 2 commits into from
Jul 5, 2023
Merged

Conversation

relu
Copy link
Member

@relu relu commented Jun 30, 2023

The implementation is similar to other Kubernetes Terraform providers
such as the kubectl or helm providers and allows the Flux provider to
authenticate against EKS clusters (or others supporting this method) by
configuring the client authentication exec plugin.

Example configuration for EKS:

provider "flux" {
  ...
  kubernetes {
    ...

    exec {
      api_version = "client.authentication.k8s.io/v1beta1"
      env         = {
        AWS_PROFILE = "example-profile"
      }
      command     = "aws"
      args        = [
        "--region",
        "us-east-1",
        "eks",
        "get-token",
        "--cluster-name",
        "example-cluster",
      ]
    }
  }
}

Closes: #406

@stefanprodan stefanprodan added the enhancement New feature or request label Jun 30, 2023
@relu relu force-pushed the kubernetes-exec branch 2 times, most recently from f8dbc43 to 342522e Compare June 30, 2023 13:17
@stefanprodan stefanprodan added the area/kubernetes Kubernetes bootstrap related issues and pull requests label Jun 30, 2023
docs/index.md Outdated Show resolved Hide resolved
docs/index.md Outdated Show resolved Hide resolved
internal/provider/provider.go Outdated Show resolved Hide resolved
internal/provider/provider_resource_data.go Outdated Show resolved Hide resolved
internal/provider/provider_resource_data.go Outdated Show resolved Hide resolved
internal/provider/provider.go Outdated Show resolved Hide resolved
@relu relu force-pushed the kubernetes-exec branch from 342522e to c6a87ce Compare July 3, 2023 14:55
@relu relu requested a review from darkowlzz July 3, 2023 14:56
@relu relu force-pushed the kubernetes-exec branch from c6a87ce to 3855a25 Compare July 3, 2023 14:58
Copy link
Contributor

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!

Left a few minor suggestions that can be addressed or ignored.

internal/provider/provider.go Outdated Show resolved Hide resolved
internal/provider/provider_resource_data.go Outdated Show resolved Hide resolved
@relu relu force-pushed the kubernetes-exec branch from 3855a25 to 8189b59 Compare July 5, 2023 10:16
relu added 2 commits July 5, 2023 12:17
Signed-off-by: Aurel Canciu <[email protected]>
The implementation is similar to other Kubernetes Terraform providers
such as the kubectl or helm providers and allows the Flux provider to
authenticate against EKS clusters (or others supporting this method) by
configuring the client authentication exec plugin.

Example configuration for EKS:

```
provider "flux" {
  ...
  kubernetes = {
    ...
    exec = {
      api_version = "client.authentication.k8s.io/v1beta1"
      env         = {
        AWS_PROFILE = "example-profile"
      }
      command     = "aws"
      args        = [
        "--region",
        "us-east-1",
        "eks",
        "get-token",
        "--cluster-name",
        "example-cluster",
      ]
    }
  }
}
```

Signed-off-by: Aurel Canciu <[email protected]>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @relu 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes Kubernetes bootstrap related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add exec plugin to provider configuration
3 participants