feat: native Go K8s operations — 12/12 migration complete#21
Merged
Conversation
New internal/k8s/ package (modeled on stackrox/roxie): RunKubectl with transient error retry + exponential backoff, RunHelm, RunOC, ApplyYAML (map → yaml.Marshal → kubectl apply -f -). 9 stub-based tests. deploy --remote: namespace, CRDs, SCCs, RBAC (Go maps), Helm install, Route, mTLS cert extraction, gateway registration. Replaces 160 lines of bash + Python (TOML parsing for chart version now native Go). teardown --k8s: Helm uninstall, CRD/SCC/secret/namespace cleanup, gateway config cleanup. All operations tolerate "not found" errors. new --remote: ConfigMap creation, Job YAML (Go map), log tailing, status polling. No more inline heredoc YAML. creds.go: K8s secret management for GWS + Atlassian credentials. Extracted from creds.sh. Gateway interface: added GatewayAdd, GatewayRemove. Only new dependency: gopkg.in/yaml.v3. Validated: unit 47+7, bats 29+29, podman 19+19, Go+OCP 17/17. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Two fixes from manual testing: 1. new --remote now runs the same prerequisite chain as the bash version: deploy (if gateway unreachable) → providers (if none registered) → creds (ensure K8s secrets) → sandbox create. Previously jumped straight to sandbox creation, failing with "namespace not found". 2. Print errors to stderr in main.go — SilenceErrors hid ALL errors including legitimate failures, producing silent exit 1 with no output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Ports all remaining K8s bash wrappers to native Go. Every command path is now native Go — 12/12.
New: internal/k8s/ package
Modeled on stackrox/roxie kubectl wrapper:
Ported commands
Fixes from manual testing
Only new dep: gopkg.in/yaml.v3.
Test results