Repository navigation
feat(auth): add GKE kubeconfig integration - #2901
Mikhail Shirkov (shirkevich) wants to merge 39 commits into
Conversation
Extends the `auth.integrations` system to Azure: `atmos azure aks token`, `atmos azure aks update-kubeconfig`, and `atmos azure acr login`, so `atmos auth login` can provision kubectl and Docker credentials for Azure the same way it already does for AWS EKS/ECR — no `az` CLI or `kubelogin` binary required. Generalizes `pkg/auth/cloud/kube.KubeconfigManager` from AWS-specific to a cloud-agnostic writer shared by both clouds, and widens the existing `Cluster`/`Registry` schema structs (renamed from `EKSCluster`/`ECRRegistry`) so `spec.cluster`/`spec.registry` are reused verbatim across `aws/eks`+`azure/aks` and `aws/ecr`+`azure/acr`. Since Azure AAD tokens are scope-bound at issuance (unlike AWS SigV4), all three Azure identity providers now acquire an AKS-scoped token at login time alongside their existing Graph/KeyVault tokens. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Bumps four vulnerable dependencies to their patched versions, all within the semver-major bump policy allowed by .github/dependabot.yml: - google.golang.org/grpc v1.81.1 -> v1.82.1 (GHSA-hrxh-6v49-42gf): xDS RBAC authorization fail-open, HTTP/2 Rapid Reset mitigation bypass, and an RBAC-engine panic. - fast-uri (website, transitive) -> 3.1.4 (GHSA-v2hh-gcrm-f6hx): host confusion via literal backslash authority delimiter. - svgo (website, transitive) -> 3.3.4 (GHSA-2p49-hgcm-8545): removeScripts plugin left some executable scripts intact. - dompurify (website, transitive) -> 3.4.12 (GHSA-c2j3-45gr-mqc4): CUSTOM_ELEMENT_HANDLING bypassed afterSanitizeElements for allowed custom elements. Regenerated NOTICE via scripts/generate-notice.sh. No CodeQL alerts were open at remediation time. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Condenses the ECR/ACR and EKS/AKS integration sections into one combined section so the file stays under agent-skills' 500-line limit. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Numbered-list continuation lines used 3-space indentation instead of a multiple of 2, and the architecture diagram had a matching off-by-one; both tripped the repo's editorconfig CI check.
The new atmos azure command group added a row to the top-level help output that the CLI acceptance-test snapshots didn't account for.
The final command-resolution merge in stack_processor_merge.go only
checked atmosConfig.Components.Terraform/Helmfile.Command, so setting
components.packer.command (or .ansible.command) in atmos.yaml, or the
matching ATMOS_COMPONENTS_*_COMMAND env var, was silently ignored for
those two component types and always fell back to the literal type
name ("packer"/"ansible") as the executable. This only went unnoticed
because the fallback happens to match the real binary name.
Also clears the FindStacksMap/baseComponentConfigCache caches in the
"missing packer binary" test: both cache the merged command by
stack-file identity, not by the env var this test relies on, so a
sibling subtest running first with the real fixture poisoned the
cache and made this test's override a no-op — the root cause of the
Acceptance Tests (windows) failure on this PR.
Address CodeRabbit feedback on PR cloudposse#2790: ExecutePacker repopulates baseComponentConfigCache/findStacksMapCache with the deliberately nonexistent test command, and t.Setenv only restores the env var, not the caches — so a later subtest or test file sharing the same stack:component cache key could reuse the stale entry.
- github.com/google/cel-go v0.26.0 -> v0.29.0 fixes GHSA-gcjh-h69q-9w9g (json:"-" struct fields were readable via CEL dyn() indexing and JSON conversion, exposing fields callers intentionally excluded). - postcss (transitive, website) override bumped to >=8.5.18 fixes GHSA-r28c-9q8g-f849 (source-map path traversal allowing arbitrary .map file disclosure). Both are within the dependabot.yml semver-major ignore policy. NOTICE regenerated for the cel-go/antlr license bump.
# Conflicts: # website/package.json # website/pnpm-lock.yaml
# Conflicts: # cmd/root.go # pkg/validator/deprecation.go
# Conflicts: # pkg/auth/identities/azure/subscription.go # pkg/auth/manager_logout.go # pkg/auth/providers/azure/cli.go # pkg/auth/providers/azure/device_code.go # pkg/auth/types/azure_credentials.go # website/src/data/roadmap.js
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (24)
🚧 Files skipped from review as they are similar to previous changes (24)
📝 WalkthroughWalkthroughThe pull request adds native GCP GKE authentication. It supports cluster discovery, kubeconfig provisioning, dynamic Kubernetes tokens, Helm identity enforcement, CLI commands, configuration schema fields, integration caching, provider-backed credential handling, tests, and documentation. ChangesGCP GKE authentication
Estimated code review effort: 4 (Complex) | ~60 minutes Mergeability Score: ⚪ Minimal · up to The PR adds GKE kubeconfig authentication and related opt-in Helm protection without any supplied actionable merge-blocking risk; it is merge-ready after normal checks and review. Possibly related PRs
Suggested labels: Sequence Diagram(s)sequenceDiagram
participant AtmosCLI
participant AuthManager
participant GKEIntegration
participant GKEAPI
participant KubeconfigManager
participant Kubernetes
AtmosCLI->>AuthManager: Resolve GCP identity
AuthManager->>GKEIntegration: Execute GCP credentials
GKEIntegration->>GKEAPI: Describe configured cluster
GKEAPI-->>GKEIntegration: Return endpoint and CA data
GKEIntegration->>KubeconfigManager: Write exec-auth kubeconfig
KubeconfigManager-->>Kubernetes: Provide kubeconfig environment
Kubernetes->>AtmosCLI: Request ExecCredential token
AtmosCLI-->>Kubernetes: Return bearer token and expiration
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
pkg/auth/integrations/gcp/gke.go (1)
168-175: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd performance tracking to
Environment.
Environmentis public and can return manager-construction errors. Adddefer perf.Track(nil, "gcp.GKEIntegration.Environment")()and a blank line.As per coding guidelines, “Add
defer perf.Track(atmosConfig, "pkg.FuncName")()plus a blank line to public functions.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/auth/integrations/gcp/gke.go` around lines 168 - 175, Add performance tracking at the start of the public GKEIntegration.Environment method by deferring perf.Track(nil, "gcp.GKEIntegration.Environment")(), followed by a blank line before the existing logic.Source: Coding guidelines
cmd/gcp/gcp.go (1)
12-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd the required embedded command usage.
gcpCmdhas static help text only. Embed its usage document fromcmd/markdown/*_usage.mdand render it withutils.PrintfMarkdown(). Include command examples in that document.As per coding guidelines, “Embed command usage examples from
cmd/markdown/*_usage.mdwith//go:embedand render them withutils.PrintfMarkdown().”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/gcp/gcp.go` around lines 12 - 17, Update gcpCmd to embed its command usage markdown from cmd/markdown via //go:embed, and render the embedded document with utils.PrintfMarkdown() instead of relying only on static Long text. Add the relevant GCP command examples to the embedded usage document while preserving the existing cobra command configuration.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/gcp/gke/token.go`:
- Around line 53-62: The authentication context in executeTokenCommand must
preserve Cobra’s cancellation and deadline while retaining skip-integrations
behavior. Replace the context.Background() input to
auth.ContextWithSkipIntegrations with cmd.Context(), and add coverage verifying
cancellation/deadline inheritance reaches authenticateForTokenFn.
In `@pkg/auth/manager_integrations.go`:
- Around line 49-53: Update the GKE key generation in the KindGCPGKE handling to
include every kubeconfig output-affecting setting consumed by Execute, including
configured path, context alias, update behavior, and exec-plugin identity, so
integrations sharing a cluster but differing in any of these values produce
distinct keys; alternatively disable GKE target deduplication. Add coverage for
integrations sharing a cluster with different paths, aliases, or identities.
In `@pkg/datafetcher/schema_auth_validation_test.go`:
- Around line 241-243: Update the kubeconfig fixture in the relevant test to set
its path with filepath.Join(t.TempDir(), "example-kubeconfig") instead of the
hardcoded Unix path, and add the path/filepath import. Preserve the existing
fixture structure and values.
In `@website/docs/cli/commands/gcp/gke/gke.mdx`:
- Around line 8-12: Complete the CLI documentation template in
website/docs/cli/commands/gcp/gke/gke.mdx lines 8-12 by adding a static
CastPlayer, Usage, and Examples sections documenting only supported flags; in
website/docs/cli/commands/gcp/gke/token.mdx lines 7-11 and
website/docs/cli/commands/gcp/usage.mdx lines 7-12, add static CastPlayer and
Examples sections documenting only supported flags. Ensure all three pages
retain the required frontmatter, Intro, and <dl> argument/flag definitions,
using CastPlayer with static rather than Screengrab.
---
Nitpick comments:
In `@cmd/gcp/gcp.go`:
- Around line 12-17: Update gcpCmd to embed its command usage markdown from
cmd/markdown via //go:embed, and render the embedded document with
utils.PrintfMarkdown() instead of relying only on static Long text. Add the
relevant GCP command examples to the embedded usage document while preserving
the existing cobra command configuration.
In `@pkg/auth/integrations/gcp/gke.go`:
- Around line 168-175: Add performance tracking at the start of the public
GKEIntegration.Environment method by deferring perf.Track(nil,
"gcp.GKEIntegration.Environment")(), followed by a blank line before the
existing logic.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 84a66aac-c6bd-4206-a824-55c0b4403475
📒 Files selected for processing (32)
cmd/gcp/gcp.gocmd/gcp/gcp_test.gocmd/gcp/gke/gke.gocmd/gcp/gke/token.gocmd/gcp/gke/token_test.gocmd/root.godocs/prd/gke-kubeconfig-authentication.mderrors/errors.gopkg/auth/cloud/gcp/gke.gopkg/auth/cloud/gcp/gke_test.gopkg/auth/cloud/kube/config.gopkg/auth/integrations/gcp/gke.gopkg/auth/integrations/gcp/gke_test.gopkg/auth/integrations/types.gopkg/auth/manager.gopkg/auth/manager_gke_integration_test.gopkg/auth/manager_integrations.gopkg/auth/manager_integrations_test.gopkg/config/schema/gke_test.gopkg/datafetcher/schema/atmos/config/1.0.jsonpkg/datafetcher/schema_auth_validation_test.gopkg/schema/schema_auth.gotests/snapshots/TestCLICommands_atmos_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_help_flag_works.stdout.goldentests/test-cases/demo-stacks.yamlwebsite/docs/cli/commands/gcp/_category_.jsonwebsite/docs/cli/commands/gcp/gke/_category_.jsonwebsite/docs/cli/commands/gcp/gke/gke.mdxwebsite/docs/cli/commands/gcp/gke/token.mdxwebsite/docs/cli/commands/gcp/usage.mdxwebsite/docs/cli/configuration/auth/index.mdx
Reject positional args and wrap the flag-bind error on `azure aks update-kubeconfig`. Disambiguate same-name/same-resource-group AKS clusters across subscriptions in both the kubeconfig cleanup lookup (findClusterID) and the exec-plugin username generated at write time (kube.BuildClusterConfig), which previously collided and could remove or overwrite the wrong cluster's kubeconfig entry. Co-Authored-By: Claude Sonnet 5 <[email protected]>
# Conflicts: # NOTICE
# Conflicts: # NOTICE
…olve The pkg/auth/integrations/azure package registers the azure/acr and azure/aks integration kinds in its init(), but nothing blank-imported it (unlike the aws and github integration packages in manager.go). As a result init() never ran, so 'atmos azure aks update-kubeconfig --integration <name>' failed with 'unknown integration kind: azure/aks'. Identity mode (--cluster-name/ --resource-group/--identity) was unaffected because it bypasses the registry. Add the blank import alongside aws and github.
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/component/helm/executor_extra_test.go (1)
352-413: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winUse table-driven identity-resolution cases.
This test covers multiple independent identity scenarios. Define each scenario as a table case. Reset
processStacksandsetupComponentAuthForCLIfor each case.As per coding guidelines, “Use table-driven tests for testing multiple scenarios in Go.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/component/helm/executor_extra_test.go` around lines 352 - 413, Refactor TestProcessStacksWithAuth into table-driven cases for each identity-resolution scenario: no identity, setup failure, resolved component default, and unresolved default. Create fresh processStacks and setupComponentAuthForCLI stubs within each case or reset them before execution, while preserving the existing assertions and error expectations; keep TestRequireIdentityForOperation unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/prd/gke-kubeconfig-authentication.md`:
- Line 62: Update the Helm non-goal statement in the document to clarify that
general Helm-specific behavior is out of scope, while explicitly preserving the
documented opt-in GKE Helm safety guard described in the earlier requirements.
In `@pkg/auth/integrations/gcp/gke.go`:
- Around line 115-134: Clear stale endpoint state throughout the GKE integration
lifecycle: in Execute, derive the expected-server key and delete it before
client creation or cluster discovery, then store the new endpoint only after
WriteClusterConfig succeeds; in Cleanup, delete the key only after
RemoveClusterConfig succeeds. Update or add coverage for successful execution
followed by discovery failure and for Cleanup, asserting Environment no longer
returns kube.ExpectedServerEnv and never uses an endpoint from an earlier
provisioning attempt.
In `@pkg/component/helm/client_test.go`:
- Around line 19-50: Refactor TestVerifyExpectedKubernetesEndpoint into a
table-driven test covering the four existing guard and endpoint scenarios,
including each case’s environment values and expected result. Iterate with a
subtest for each case, keeping the relevant t.Setenv calls inside the subtest
and preserving the current error assertions for mismatched endpoints.
In `@pkg/component/helm/executor_test.go`:
- Line 214: Update the test around the processStacks calls to capture both
invocations instead of comparing only processTemplates with
processYamlFunctions. Assert the discovery call receives true, false, false, and
the full processing call receives true, true, true.
In `@pkg/datafetcher/schema_auth_validation_test.go`:
- Around line 151-182: Update both identity-guard test cases in the schema
validation table to place the manifest under components.helmfile instead of
components.terraform, preserving their true and invalid-string require_identity
values and expected errors so the helmfile_component_manifest validation path is
exercised.
---
Outside diff comments:
In `@pkg/component/helm/executor_extra_test.go`:
- Around line 352-413: Refactor TestProcessStacksWithAuth into table-driven
cases for each identity-resolution scenario: no identity, setup failure,
resolved component default, and unresolved default. Create fresh processStacks
and setupComponentAuthForCLI stubs within each case or reset them before
execution, while preserving the existing assertions and error expectations; keep
TestRequireIdentityForOperation unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: daa9f924-5f14-40ed-af0b-b65312de0402
📒 Files selected for processing (44)
cmd/gcp/gcp.gocmd/gcp/gcp_test.gocmd/gcp/gke/gke.gocmd/gcp/gke/token.gocmd/gcp/gke/token_test.gocmd/gcp/markdown/atmos_gcp_usage.mdcmd/root.godemo/casts/atmos.d/screengrabs/cli.yamldocs/prd/gke-kubeconfig-authentication.mderrors/errors.gopkg/auth/cloud/gcp/gke.gopkg/auth/cloud/gcp/gke_test.gopkg/auth/cloud/kube/config.gopkg/auth/integrations/gcp/gke.gopkg/auth/integrations/gcp/gke_test.gopkg/auth/integrations/types.gopkg/auth/manager.gopkg/auth/manager_gke_integration_test.gopkg/auth/manager_integrations.gopkg/auth/manager_integrations_test.gopkg/component/helm/client.gopkg/component/helm/client_test.gopkg/component/helm/executor.gopkg/component/helm/executor_extra_test.gopkg/component/helm/executor_test.gopkg/config/schema/gke_test.gopkg/datafetcher/schema/atmos/config/1.0.jsonpkg/datafetcher/schema/atmos/manifest/1.0.jsonpkg/datafetcher/schema_auth_validation_test.gopkg/schema/schema_auth.gotests/snapshots/TestCLICommands_atmos_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_atmos_non-existent.stderr.goldentests/snapshots/TestCLICommands_help_flag_works.stdout.goldentests/test-cases/demo-stacks.yamlwebsite/docs/cli/commands/gcp/_category_.jsonwebsite/docs/cli/commands/gcp/gke/_category_.jsonwebsite/docs/cli/commands/gcp/gke/gke.mdxwebsite/docs/cli/commands/gcp/gke/token.mdxwebsite/docs/cli/commands/gcp/usage.mdxwebsite/docs/cli/configuration/auth/index.mdxwebsite/static/casts/screengrabs/atmos-gcp--help.castwebsite/static/casts/screengrabs/atmos-gcp-gke--help.castwebsite/static/casts/screengrabs/atmos-gcp-gke-token--help.cast
🚧 Files skipped from review as they are similar to previous changes (24)
- website/docs/cli/commands/gcp/category.json
- website/docs/cli/commands/gcp/gke/category.json
- website/docs/cli/commands/gcp/usage.mdx
- tests/test-cases/demo-stacks.yaml
- pkg/auth/manager_gke_integration_test.go
- pkg/auth/integrations/types.go
- pkg/auth/cloud/gcp/gke_test.go
- pkg/config/schema/gke_test.go
- cmd/gcp/gke/token_test.go
- website/docs/cli/configuration/auth/index.mdx
- cmd/gcp/gcp.go
- pkg/auth/manager.go
- tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
- pkg/auth/manager_integrations_test.go
- tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
- website/docs/cli/commands/gcp/gke/token.mdx
- tests/snapshots/TestCLICommands_help_flag_works.stdout.golden
- pkg/auth/cloud/gcp/gke.go
- pkg/schema/schema_auth.go
- cmd/gcp/gke/gke.go
- cmd/gcp/gke/token.go
- cmd/root.go
- cmd/gcp/gcp_test.go
- pkg/datafetcher/schema/atmos/config/1.0.json
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## osterman/aks-acr-support #2901 +/- ##
============================================================
+ Coverage 82.76% 82.98% +0.22%
============================================================
Files 1861 1893 +32
Lines 180478 183924 +3446
============================================================
+ Hits 149380 152638 +3258
- Misses 23311 23409 +98
- Partials 7787 7877 +90
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
pkg/auth/identities/gcp_project/identity_test.go (1)
351-357: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the identity-backed path.
hasUpstreamCredentialSourcehandles bothVia.ProviderandVia.Identity, but these tests cover onlyVia.Provider. Add a table-drivenVia.Identitycase and assert thatCredentialsExistreturnsfalseandLoadCredentialsreturnsnil.As per coding guidelines, new Go tests must use behavior-focused, table-driven unit tests and target at least 85% coverage.
Also applies to: 375-387
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/auth/identities/gcp_project/identity_test.go` around lines 351 - 357, Add a behavior-focused, table-driven identity-backed case to the tests around CredentialsExist, configuring schema.Identity.Via.Identity instead of only Via.Provider. Assert that CredentialsExist returns false without error and LoadCredentials returns nil for this case, while preserving the existing provider-backed coverage and following the repository’s table-driven test style.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/prd/gke-kubeconfig-authentication.md`:
- Around line 69-70: Update the documentation’s ADC wording so it distinguishes
not bootstrapping Application Default Credentials directly from consuming
credentials supplied by the configured gcp/adc provider. Revise the statement
around the integration design and the verification text around the end-to-end
test to remain consistent, without changing the described authentication flow.
- Line 92: Update the verification command in the documentation around atmos
auth exec to replace the <readiness-summary> placeholder with a valid jq filter
so the complete kubectl pipeline is directly executable; do not leave it as
shell redirection syntax.
---
Nitpick comments:
In `@pkg/auth/identities/gcp_project/identity_test.go`:
- Around line 351-357: Add a behavior-focused, table-driven identity-backed case
to the tests around CredentialsExist, configuring schema.Identity.Via.Identity
instead of only Via.Provider. Assert that CredentialsExist returns false without
error and LoadCredentials returns nil for this case, while preserving the
existing provider-backed coverage and following the repository’s table-driven
test style.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: aeb92114-1376-4c49-99d7-3edceb806d5a
📒 Files selected for processing (3)
docs/prd/gke-kubeconfig-authentication.mdpkg/auth/identities/gcp_project/identity.gopkg/auth/identities/gcp_project/identity_test.go
|
CodeRabbit (@coderabbitai) review Please run an incremental review of the latest head, 36071a6. This commit preserves global auth integrations and console settings during component auth merges, adds deep-copy and override/environment regression coverage, and documents guard opt-out semantics plus sanitized combined-run evidence. |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/auth/config_helpers_test.go (1)
191-228: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winVerify alias isolation in both mutation directions.
This test mutates
copyand checksoriginal. Add a fresh-copy case that mutatesoriginaland checks thatcopyremains unchanged for console, integration pointers, and repository slices.As per coding guidelines, “For aliasing tests verify isolation in both mutation directions.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/auth/config_helpers_test.go` around lines 191 - 228, Extend the deep-copy test after the existing copy-mutation assertions with a fresh copy, then mutate the original’s Console.Isolated, example-gke integration pointer fields, and Repos slice and assert the fresh copy retains its original values. Cover both pointer-backed integration settings and repository slice contents to verify alias isolation in the reverse mutation direction.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/auth/config_helpers_test.go`:
- Around line 191-228: Extend the deep-copy test after the existing
copy-mutation assertions with a fresh copy, then mutate the original’s
Console.Isolated, example-gke integration pointer fields, and Repos slice and
assert the fresh copy retains its original values. Cover both pointer-backed
integration settings and repository slice contents to verify alias isolation in
the reverse mutation direction.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7cfd30e0-1e23-41fb-ade2-e98baf5065fe
📒 Files selected for processing (24)
cmd/gcp/gcp.gocmd/gcp/gcp_test.gocmd/gcp/gke/token.gocmd/gcp/gke/token_test.godocs/prd/gke-kubeconfig-authentication.mdinternal/exec/utils_auth.gointernal/exec/utils_auth_test.gopkg/auth/cloud/gcp/gke.gopkg/auth/cloud/gcp/gke_test.gopkg/auth/config_helpers.gopkg/auth/config_helpers_test.gopkg/auth/identities/gcp_project/identity.gopkg/auth/identities/gcp_project/identity_test.gopkg/auth/integrations/gcp/gke.gopkg/auth/integrations/gcp/gke_test.gopkg/auth/manager_gke_integration_test.gopkg/auth/manager_integrations.gopkg/auth/manager_integrations_test.gopkg/component/helm/client.gopkg/component/helm/client_test.gopkg/component/helm/executor.gopkg/component/helm/executor_extra_test.gopkg/config/schema/gke_test.gopkg/datafetcher/schema_auth_validation_test.go
🚧 Files skipped from review as they are similar to previous changes (16)
- pkg/config/schema/gke_test.go
- pkg/auth/identities/gcp_project/identity.go
- cmd/gcp/gcp_test.go
- pkg/auth/manager_integrations_test.go
- pkg/auth/cloud/gcp/gke_test.go
- pkg/component/helm/executor_extra_test.go
- pkg/datafetcher/schema_auth_validation_test.go
- pkg/auth/integrations/gcp/gke_test.go
- pkg/component/helm/executor.go
- pkg/auth/manager_gke_integration_test.go
- pkg/auth/manager_integrations.go
- pkg/component/helm/client.go
- pkg/component/helm/client_test.go
- cmd/gcp/gke/token.go
- cmd/gcp/gke/token_test.go
- pkg/auth/cloud/gcp/gke.go
|
CodeRabbit (@coderabbitai) review |
✅ Action performedReview finished.
|
acdff40 to
21cadd2
Compare
|
💥 This pull request now has conflicts. Could you fix it Mikhail Shirkov (@shirkevich)? 🙏 |
Summary
Adds native GKE kubeconfig authentication as an Atmos Auth integration, stacked on #2790 because it reuses the shared EKS/AKS kubeconfig writer introduced there.
gcp/gkewith requiredproject_id,location, and clusternameprojects/{project}/locations/{location}/clusters/{name}resource through the native GKE API using Atmos-issuedGCPCredentialsatmos gcp gke tokenas the kubeconfig exec plugin, preserving Cobra cancellation/deadlines while suppressing recursive integration executionKUBECONFIGandKUBE_CONFIG_PATHthrough the Auth identity environmentgcp/projectidentities instead of accepting project-only context as cached credentialsauth.require_identity: true, for state-changing native Helm operationsArchitecture and security
The kubeconfig stores the GKE endpoint, CA data, and an Atmos exec stanza only. It never persists an OAuth bearer token. Cluster discovery and token output both require the GCP credential type already produced by Atmos Auth.
The GKE integration does not invoke
gcloud, bootstrap Application Default Credentials itself, or requiregke-gcloud-auth-plugin. Credentials can come from any configured Atmos GCP identity chain; the live verification below used an existinggcp/adcprovider as that chain's source. The token command writes only KubernetesExecCredentialJSON to stdout and does not include sensitive token material in errors.With no custom path, Atmos writes an Atmos-owned kubeconfig under the XDG config directory. Configuring a shared kubeconfig path is explicit opt-in and may update that file's
current-context.The optional Helm guard resolves the component's default identity when
--identityis omitted, requires a successfully provisioned GKE endpoint, and compares that endpoint with the effective Kubernetes REST configuration before Helm mutates the cluster. The guard is off by default, covers GKE only, and does not change existing AWS EKS or Azure AKS behavior.Example configuration uses generic names:
The runtime identity needs permission to call
container.clusters.get; Kubernetes authorization remains controlled by cluster RBAC.Custom blocking Helm hooks remain supported. They must use
on_failure: failto block execution, and hook scripts should use absolute or repository-resolved paths because hooks run from the component directory.Review follow-up
Addresses the original CodeRabbit findings by:
atmos gcp gke tokenThe post-push CI follow-up also updates the invalid-command golden snapshot for the new
gcpcommand and fixes the Docusaurus GKE parent-page route.Live verification then caught a first-use bug that unit tests had missed: a provider-backed
gcp/projectidentity returned project-only local credentials with no token, so Auth treated them as a valid non-expiring cache entry and skipped the ADC provider and linked GKE provisioning. Provider-backed project identities now report no local cached credentials, forcing their configured upstream chain to authenticate; standalone project-context behavior is unchanged.Manual testing (live GKE cluster)
Exercised end-to-end on 2026-08-12 against a real regional GKE cluster. Project, cluster, endpoint, principal, and node names are omitted; aliases below are generic.
atmos auth execwithout a preparatoryatmos auth loginorgcloud container clusters get-credentials.atmos gcp gke token.v1.34.9-gke.1065000.atmos gcp gke token --identity=example-deployer, and no stored bearer token.client.authentication.k8s.io/v1beta1,ExecCredential, a non-empty token, and an expiration timestamp.PATH; preflight confirmed that neithergcloudnorgke-gcloud-auth-pluginwas available, and all four nodes remained reachable and Ready.Sanitized first-use result:
The full evidence and the bug found by this run are recorded in
docs/prd/gke-kubeconfig-authentication.md.Validation
go test ./pkg/auth/identities/gcp_project ./pkg/auth/integrations/gcp ./cmd/gcp/gke -count=1— passedgo test ./pkg/auth -count=1— passedgo test -p=4 ./pkg/auth/... -count=1— 3,989 passed across 37 packages before the live-test follow-up; the focused changed packages were rerun afterwardgo test -p=1 ./pkg/component/helm ./pkg/datafetcher ./pkg/auth/integrations/gcp -count=1— 335 passed across 3 packagesgo build .— passed after the live-test fixgit diff --check— passedStack dependency
This PR intentionally targets
osterman/aks-acr-support/ #2790 because the GKE integration reuses its shared Kubernetes kubeconfig implementation. The branch has merged the latest target-branch state to keep the PR conflict-free.No AWS or Azure integration behavior is changed by this PR. The new strict identity/endpoint behavior is component opt-in and GKE-only. After #2790 merges, this PR should be retargeted to
mainand the inherited base commits removed as appropriate.Summary by CodeRabbit
atmos gcp gke tokenfor Kubernetes-compatible authentication tokens.