feat: install krew + kubectl oidc-login plugin#497
Merged
Conversation
Adds the kubectl plugin manager (krew) and pre-installs the oidc-login plugin so users can sign in to GlueOps clusters via OIDC the way the developer docs describe (kubectl krew install oidc-login + $HOME/.krew/bin on PATH) without any manual setup. - New ARG VERSION_KREW renovate-tracked from kubernetes-sigs/krew. - krew installs to $HOME/.krew as the vscode user; oidc-login is then installed via krew per the canonical instructions. - Build fails fast if either kubectl krew version or kubectl oidc-login --help does not succeed. - $HOME/.krew/bin appended to PATH in /home/vscode/.zshrc so kubectl finds plugins without any user-side configuration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Switches from "kubectl krew install oidc-login" (which pulls whatever the krew-index has at build time) to "--manifest-url" against a specific krew-index commit SHA. The pinned manifest itself fixes the upstream kubelogin binary version and sha256, so two builds of the same Docker tag now resolve to byte-identical oidc-login binaries. Bump instructions are inlined as a comment above the ARG. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds krew (kubectl plugin manager) and pre-installs the oidc-login plugin into the devcontainer image so developers can authenticate to clusters via OIDC without manual setup.
Changes:
- Introduces a renovate-tracked
VERSION_KREWbuild arg and installs krew under thevscodeuser’s home. - Installs the
oidc-loginplugin during build and validates installation by runningkubectl krew versionandkubectl oidc-login --help. - Updates
/home/vscode/.zshrcPATH export to include$HOME/.krew/bin.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Krew-index has no tags or releases, so the SHA pin was not renovate-trackable without a custom regex manager. Per discussion, going with "kubectl krew install oidc-login" against latest in the index instead. krew itself sha256-verifies the downloaded binary against the manifest, so transport integrity still holds. Versions will drift on rebuilds, which is acceptable for a developer codespace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two hardening tweaks surfaced by adversarial review:
1. PATH coverage: kubeconfig "exec:" plugins (the oidc-login auth flow)
inherit PATH from whichever process spawned kubectl. If that process
is not an interactive zsh shell, the prior .zshrc-only PATH update
wouldn't reach the plugin. Now:
- ENV PATH at the container level so every spawned process (including
non-interactive scripts and CI) sees $HOME/.krew/bin.
- Same export also tee'd into .bashrc for parity with .zshrc.
2. ~/.kube directory created with mode 0700 instead of the default 0755
so directory listings can't leak cluster/issuer names to other UIDs
inside the container. kubelogin's own cache files are already 0600.
Co-Authored-By: Claude Opus 4.7 (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
oidc-loginplugin so users can authenticate to GlueOps clusters via OIDC without any manual setup.kubectl krew install oidc-login,$HOME/.krew/binon PATH) — but now those steps are baked into the image.Changes
VERSION_KREWARG, renovate-tracked fromkubernetes-sigs/krew.$HOME/.krewas thevscodeuser, thenkubectl krew install oidc-loginruns.kubectl krew versionorkubectl oidc-login --helpdoes not succeed.$HOME/.krew/binappended to PATH in/home/vscode/.zshrc.Test plan
docker build -t test .devcontainer/) and confirm bothkubectl krew versionandkubectl oidc-login --helpsucceed during build.!vmin#testing-developer-workspaces) and verifykubectl krew listshowsoidc-loginwithout any user action.kubectl oidc-login --helpto confirm the plugin resolves through$HOME/.krew/binon PATH.Companion docs: GlueOps/glueops-dev#482 — Reader Plus tier, also referencing this same krew/oidc-login flow.
🤖 Generated with Claude Code