Skip to content

fix(kube): Update kube scripts to pull from ghcr - #513

Merged
matthewgrossman merged 8 commits into
mainfrom
mgrossman/aircore-857-gpu-testing-on-dev-blue-via-minikube
Jun 30, 2026
Merged

fix(kube): Update kube scripts to pull from ghcr#513
matthewgrossman merged 8 commits into
mainfrom
mgrossman/aircore-857-gpu-testing-on-dev-blue-via-minikube

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Add GHCR image pull support to the K8s e2e scripts, and consolidate duplicated code across setup scripts into a shared lib.sh.

Changes

New: e2e/k8s/scripts/lib.sh

  • Shared log helpers (log_info, log_warn, log_error) — previously duplicated in every setup script
  • create_platform_secrets() — creates NGC, GHCR, and HuggingFace secrets when their corresponding env vars are set

e2e/k8s/scripts/install_helm_e2e.sh

  • Sources lib.sh instead of defining its own log functions
  • Automatically adds imagePullSecrets to the helm chart when NGC_API_KEY (for nvcr.io) and/or GITHUB_TOKEN (for ghcr.io) are set

e2e/k8s/scripts/setup_local_minikube_gpu.sh

  • Sources lib.sh, removes duplicated log functions and secret creation
  • Calls create_platform_secrets which now handles GHCR pull secret creation

e2e/k8s/scripts/setup_local_minikube_cpu.sh

  • Same consolidation as GPU script

e2e/k8s/scripts/setup_local_kind_cpu.sh

  • Same consolidation as GPU script

Motivation

When deploying NeMo Platform on dev-blue (or any environment using GHCR pre-built images), the scripts needed to:

  1. Create a ghcr-pull K8s secret for kubelet to authenticate to ghcr.io
  2. Pass imagePullSecrets to the helm chart so pods reference the secret
  3. Also pass nvcrimagepullsecret for NIM container images from nvcr.io

This logic was missing from the OSS scripts (it existed in Platform-Deploy for GitLab but was stripped during the port). The secret creation was also duplicated across 3 setup scripts, requiring identical changes in all 3 files.

Test plan

  • Deployed NeMo Platform on dev-blue with GHCR images — all 19 services healthy
  • Deployed a NIM model (Llama 3.2 1B) — GPU inference working on A100
  • Verified create_platform_secrets creates correct secrets when env vars are set
  • Verified secrets are skipped with a warning when env vars are unset
  • Verified CI kind flow still works (passes NGC_API_KEY placeholder)

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman requested review from a team as code owners June 29, 2026 23:30
@github-actions github-actions Bot added the fix label Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds lib.sh with shared logging and platform-secret helpers. The Kind and Minikube setup scripts now source it and call create_platform_secrets. install_helm_e2e.sh also sources it and adds conditional imagePullSecrets Helm values.

Changes

k8s Secret Helper and Helm Wiring

Layer / File(s) Summary
lib.sh: logging and create_platform_secrets
e2e/k8s/scripts/lib.sh
New file defining log_info/log_warn/log_error and create_platform_secrets, which creates ngc-api, nvcrimagepullsecret, ghcr-pull, and huggingface-token secrets from env vars.
Setup scripts source lib.sh and delegate secrets
e2e/k8s/scripts/setup_local_kind_cpu.sh, e2e/k8s/scripts/setup_local_minikube_cpu.sh, e2e/k8s/scripts/setup_local_minikube_gpu.sh
Each script adds SCRIPT_DIR detection, sources lib.sh, removes inline color/logging and secret-creation code, and replaces it with create_platform_secrets "${KUBE_NAMESPACE}".
Helm imagePullSecrets wiring via GITHUB_TOKEN
e2e/k8s/scripts/install_helm_e2e.sh
install_helm_e2e.sh now sources lib.sh, removes local logging helpers, and appends imagePullSecrets entries for nvcrimagepullsecret and ghcr-pull based on available tokens.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: kube scripts now add GHCR pull-secret handling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mgrossman/aircore-857-gpu-testing-on-dev-blue-via-minikube

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 21936/28740 76.3% 61.0%
Integration Tests 12594/27420 45.9% 19.3%

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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 `@e2e/k8s/scripts/create_secrets.sh`:
- Around line 26-35: Stop passing secret values through kubectl command
arguments in create_secrets.sh, since the ngc_key is currently exposed via
create secret generic and create secret docker-registry. Update the secret
creation flow to generate Secret manifests without embedding tokens in
argv—either pipe YAML/JSON to kubectl apply via stdin or write to a 0600 temp
file and apply it. Apply the same pattern to the other token-based secret blocks
referenced in the script, and use the existing helpers like log_info and
kubectl_ns only for non-sensitive command parts.
- Around line 39-42: The GHCR pull secret in create_secrets.sh is using the
wrong docker username for a GITHUB_TOKEN. Update the create_secrets.sh secret
creation command to use the actual GitHub account name (the Actions actor)
instead of x-access-token, and keep the existing ghcr-pull secret setup
consistent with the kubectl_ns/create secret docker-registry flow.
🪄 Autofix (Beta)

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: Enterprise

Run ID: 1df2534d-6675-408b-9b66-ccf8b261ee8d

📥 Commits

Reviewing files that changed from the base of the PR and between 438763f and 101ad89.

📒 Files selected for processing (4)
  • e2e/k8s/scripts/create_secrets.sh
  • e2e/k8s/scripts/setup_local_kind_cpu.sh
  • e2e/k8s/scripts/setup_local_minikube_cpu.sh
  • e2e/k8s/scripts/setup_local_minikube_gpu.sh

Comment thread e2e/k8s/scripts/create_secrets.sh Outdated
Comment thread e2e/k8s/scripts/create_secrets.sh Outdated
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
e2e/k8s/scripts/install_helm_e2e.sh (1)

227-232: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Split imagePullSecrets by backing credential.

create_platform_secrets only creates nvcrimagepullsecret when NGC_API_KEY is set, but this block adds it whenever GITHUB_TOKEN is present. That can render pods with a nonexistent pull secret in GHCR-only setups. Gate each secret independently.

Suggested fix
+pull_secret_index=0
+
 if [ -n "${GITHUB_TOKEN:-}" ]; then
     HELM_ARGS+=(
-        --set "imagePullSecrets[0].name=ghcr-pull"
-        --set "imagePullSecrets[1].name=nvcrimagepullsecret"
+        --set "imagePullSecrets[${pull_secret_index}].name=ghcr-pull"
     )
+    pull_secret_index=$((pull_secret_index + 1))
+fi
+
+if [ -n "${NGC_API_KEY:-}" ]; then
+    HELM_ARGS+=(
+        --set "imagePullSecrets[${pull_secret_index}].name=nvcrimagepullsecret"
+    )
 fi
🤖 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 `@e2e/k8s/scripts/install_helm_e2e.sh` around lines 227 - 232, The Helm
argument setup in install_helm_e2e.sh is coupling both imagePullSecrets to
GITHUB_TOKEN, which can add nvcrimagepullsecret even when
create_platform_secrets never creates it. Update the HELM_ARGS block so each
secret is gated independently: keep ghcr-pull tied to GITHUB_TOKEN, and only
append nvcrimagepullsecret when the same condition used by
create_platform_secrets for NGC_API_KEY is satisfied. Refer to the HELM_ARGS
array construction and create_platform_secrets behavior to align the secret
names with their backing credentials.
🤖 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 `@e2e/k8s/scripts/lib.sh`:
- Around line 27-49: The helper in log/create secret flow creates ghcr-pull when
GITHUB_TOKEN is set, but nvcrimagepullsecret is only created inside the
NGC_API_KEY branch, so imagePullSecrets can reference a secret that does not
exist. Update the secret-creation logic in the script’s NGC/GHCR handling so
nvcrimagepullsecret is only wired when NGC_API_KEY is present, or otherwise
ensure that create secret docker-registry nvcrimagepullsecret is always executed
before any code paths that add it to imagePullSecrets.

---

Outside diff comments:
In `@e2e/k8s/scripts/install_helm_e2e.sh`:
- Around line 227-232: The Helm argument setup in install_helm_e2e.sh is
coupling both imagePullSecrets to GITHUB_TOKEN, which can add
nvcrimagepullsecret even when create_platform_secrets never creates it. Update
the HELM_ARGS block so each secret is gated independently: keep ghcr-pull tied
to GITHUB_TOKEN, and only append nvcrimagepullsecret when the same condition
used by create_platform_secrets for NGC_API_KEY is satisfied. Refer to the
HELM_ARGS array construction and create_platform_secrets behavior to align the
secret names with their backing credentials.
🪄 Autofix (Beta)

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: Enterprise

Run ID: 3818af6b-194b-4877-bdac-57d593e082cc

📥 Commits

Reviewing files that changed from the base of the PR and between 101ad89 and 8015407.

📒 Files selected for processing (5)
  • e2e/k8s/scripts/install_helm_e2e.sh
  • e2e/k8s/scripts/lib.sh
  • e2e/k8s/scripts/setup_local_kind_cpu.sh
  • e2e/k8s/scripts/setup_local_minikube_cpu.sh
  • e2e/k8s/scripts/setup_local_minikube_gpu.sh

Comment thread e2e/k8s/scripts/lib.sh Outdated
…e-via-minikube

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@svvarom
svvarom self-requested a review June 30, 2026 17:01
Comment thread e2e/k8s/scripts/lib.sh Outdated
Comment thread e2e/k8s/scripts/setup_local_minikube_cpu.sh
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

@svvarom svvarom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@matthewgrossman
matthewgrossman added this pull request to the merge queue Jun 30, 2026
Merged via the queue into main with commit e9f32b1 Jun 30, 2026
52 checks passed
@matthewgrossman
matthewgrossman deleted the mgrossman/aircore-857-gpu-testing-on-dev-blue-via-minikube branch June 30, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants