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 a "strict mode" configuration option #2425

Merged
merged 4 commits into from
May 24, 2023
Merged

Conversation

lblackstone
Copy link
Member

Proposed changes

The Kubernetes provider selects a target cluster based on information in a kubeconfig file, which contains one or more context settings. If these options are not explicitly specified in a Pulumi stack, the provider will attempt to load ambient configuration similarly to most Kubernetes CLI tooling. While this behavior makes it easier to get started quickly, it is not always desirable in production stacks.

In "strict mode", the default Kubernetes provider is disabled, and the kubeconfig and context settings are required for Provider configuration. These settings unambiguously ensure that every Kubernetes resource is associated with a particular cluster.

These options are already available individually, but "strict mode" makes it more convenient to enforce across a project or stack.

Related issues (optional)

Fix #2423

The Kubernetes provider selects a target cluster based on information in a `kubeconfig` file, which contains one or more context settings. If these options are not explicitly specified in a Pulumi stack, the provider will attempt to load ambient configuration similarly to most Kubernetes CLI tooling. While this behavior makes it easier to get started quickly, it is not always desirable in production stacks.

In "strict mode", the default Kubernetes provider is disabled, and the `kubeconfig` and `context` settings are required for Provider configuration. These settings unambiguously ensure that every Kubernetes resource is associated with a particular cluster.

These options are already available individually, but "strict mode" makes it more convenient to enforce across a project or stack.
@lblackstone
Copy link
Member Author

lblackstone commented May 23, 2023

The test passes locally, but I'll need to figure out a solution for CI since the test cluster context name is auto-generated.

I realized that this is fine since the Provider is expected to fail before it connects to the cluster anyway.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@lblackstone lblackstone marked this pull request as ready for review May 24, 2023 01:48
@lblackstone lblackstone requested a review from a team May 24, 2023 01:48
@lblackstone lblackstone enabled auto-merge (squash) May 24, 2023 20:04
@lblackstone lblackstone merged commit 08a0943 into master May 24, 2023
18 checks passed
@lblackstone lblackstone deleted the lblackstone/strict-mode branch May 24, 2023 20:47
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

Successfully merging this pull request may close these issues.

Add a "strict mode" that requires "kubeconfig" and "context"
3 participants