feat: pinnable context names per profile#32
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional safety check to prevent deploying with the “wrong” active Kubernetes context by allowing profiles to pin an expected current-context name via contextMappings.
Changes:
- Introduces
contextMappingsin configuration to map profile names to expected kubeconfig context names. - Passes the selected profile into the deploy command so it can enforce the expected context.
- Adds deploy-time validation that compares the active kubeconfig context to the configured expected value and errors on mismatch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/main.rs |
Threads profile through to cmd::deploy::run(...) so deploy can apply profile-specific checks. |
src/config.rs |
Adds context_mappings (contextMappings in YAML) to the config model with a default empty map. |
src/cmd/deploy.rs |
Implements context enforcement and introduces contextual error types for mismatch/missing kube context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4320e5e to
28ac29c
Compare
28ac29c to
7f8f55d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to prevent deploying to the wrong cluster you can now enforce a specific context name per profile with something like