Skip to content

fix(k8s): check the credential sync context as a kubeconfig name - #4916

Merged
dan-petty merged 5 commits into
mainfrom
fix/4091-credential-sync-context-validator
Nov 12, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/4091-credential-sync-context-validator

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The Secret read of the credential sync checked the kubeconfig context with the RFC 1123 validator, so deploy-stack --stack infra exited with status 1 after the deploy when the context was an EKS ARN. The read now uses validate_k8s_context_name, the validator of deploy-stack and switch-context. It still refuses an empty name, a space and shell metacharacters before it starts kubectl. The context test deploys the infra stack again with an ARN context, in place of the logging stand-in that hid the defect.

Closes #4091

Change: openspec/changes/archive/2026-11-12-4091-credential-sync-refuses-a-context-that/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 12, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test record

All runs are local, on the final code (head cfbc092fc, rebased on origin/main).

  • uv run devops ci test tests/k8s/test_k8s_credentials.py tests/commands/k8s/test_k8s_context.py: 87 passed. Before the fix, 2 failed with Invalid context: 'arn:aws:eks:us-east-1:123456789012:cluster/prod'. Must be a valid RFC 1123 name.
  • uv run devops ci test on the tests of the modules that use devops_cli.k8s.credentials (test_k8s_qdrant_security, test_http_egress, test_k8s_deploy_stack_urls, test_k8s_devops_stack, test_k8s_logging_stack, test_argo_credentials, test_grafana, test_validation): 319 passed.
  • uv run mypy src/devops_cli/k8s/credentials.py: no issues.
  • uv run devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures: all rows pass.

fail-to-pass

uv run devops ci fail-to-pass --base origin/main:

  failed on base: tests.commands.k8s.test_k8s_context::test_deploy_and_teardown_stack_use_effective_context (AssertionError: ! kubectl version 1.37.2 is outside the supported skew for Kubernetes API s
  failed on base: tests.k8s.test_k8s_credentials::test_fetch_argocd_password_reads_the_secret_with_an_eks_arn_context (typer.exceptions.Exit: 1)
2 failed on base (2 failed and 85 passed in tests/commands/k8s/test_k8s_context.py, tests/k8s/test_k8s_credentials.py; 0 errored).

The assertion message of the first test starts with the command output; the same output ends with the RFC 1123 error. The 3 cases of test_fetch_argocd_password_refuses_an_unsafe_context_and_starts_no_kubectl pass on the base too: they keep the refusal of an unsafe context when the check changes.

Follow-up

No live step is necessary.

@dan-petty
dan-petty marked this pull request as ready for review November 12, 2026 04:06
@dan-petty
dan-petty merged commit 8797c88 into main Nov 12, 2026
27 checks passed
@dan-petty
dan-petty deleted the fix/4091-credential-sync-context-validator branch November 12, 2026 04:06
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.116.0](v0.115.0...v0.116.0)
(2026-11-12)


### Features

* **gh:** name the gh groups issue, run, label and secret
([#4923](#4923))
([2dd4c97](2dd4c97))


### Bug Fixes

* **ci:** set job timeouts from the measured run times
([#4892](#4892))
([e26dde5](e26dde5))
* **design:** check the design test bound and source hex values
([#4922](#4922))
([e2c1a5a](e2c1a5a))
* **k8s:** check the credential sync context as a kubeconfig name
([#4916](#4916))
([8797c88](8797c88))
* **roadmap:** bound the stage gate returns and start no return in a
drain ([#4925](#4925))
([77eed38](77eed38))
* **roadmap:** count each implement outcome once with its repo
([#4903](#4903))
([c17f71f](c17f71f))
* **roadmap:** refine looks again at a wait that older rules set
([#4919](#4919))
([e6f7cb9](e6f7cb9))


### Performance Improvements

* **k8s:** put the dependencies in their own image layers
([#4872](#4872))
([48dc866](48dc866))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): credential sync refuses a context that is no RFC 1123 name

1 participant