Skip to content

fix(ocp/connect): consume forge_kubeconfig channel with kubeconfig_content fallback (v1.0.1) - #67

Open
JLCode-tech wants to merge 1 commit into
release/2.2from
fix/ocp-connect-forge-kubeconfig-channel
Open

fix(ocp/connect): consume forge_kubeconfig channel with kubeconfig_content fallback (v1.0.1)#67
JLCode-tech wants to merge 1 commit into
release/2.2from
fix/ocp-connect-forge-kubeconfig-channel

Conversation

@JLCode-tech

Copy link
Copy Markdown
Owner

What

infra/ocp/connect v1.0.1 — consume forge's established kubeconfig channel instead of relying solely on the module-private kubeconfig_content variable.

New precedence in local.kubeconfig:

  1. local.forge_kubeconfig (injected by forge when the project has a registered cluster — fresh from DB each run, normalized, SSH-tunnel-rewritten)
  2. var.kubeconfig_content when non-empty (manual / standalone use — unchanged behavior)
  3. token-based fallback built from api_server_url + oc_token (unchanged)

Why

Review discussion on bnk-forge PR #406: the module never referenced local.forge_kubeconfig/forge_kubeconfig_content, so _inject_forge_kubeconfig_locals' usage gate skipped it and users had to hand-paste kubeconfigs (or worse, stale placeholder values persisted in module overrides). Adopting the catalog-wide try(local.forge_kubeconfig, …) idiom (same as cert-manager, live-observability-loki) fixes that at the source and picks up capabilities the backend variable-injection path doesn't have (per-run refresh, SSH-tunnel server rewrite).

Because the forge local now wins whenever a registered cluster exists, stale kubeconfig_content overrides (e.g. a persisted "<username>" placeholder) no longer break deploys.

Verification

  • tofu fmt -check clean; tofu validate passes with the forge-injected locals shape (stub bnk_forge_locals.tf).
  • Standalone tofu validate without any injected locals fails on the undeclared local — verified byte-identical behavior on the unmodified cert-manager module, i.e. the pre-existing catalog-wide convention, not a regression (forge always injects the locals file before init/validate for modules referencing it).
  • module.json valid JSON; version bumped 1.0.0 → 1.0.1 so the release re-imports (BlueprintRelease immutability).

Follow-up (flagged, out of scope)

outputs.tf exposes output "kubeconfig_content" with the same name as the input variable; now that the output can reflect the forge-injected value, a rename to something like resolved_kubeconfig would clarify — left untouched here to keep the diff minimal.

…ntent fallback (v1.0.1)

Precedence for the kubeconfig local is now: local.forge_kubeconfig (injected
by BNK-Forge's config_writer whenever this workspace's project has a
registered cluster) > var.kubeconfig_content (manual/standalone override,
kept for backward compat) > the existing token-based yamlencode fallback.

Matches the try(local.forge_kubeconfig, ...) convention already used by
cert-manager and live-observability-* modules, so ocp/connect picks up the
project's registered-cluster kubeconfig automatically instead of requiring
a manually-supplied kubeconfig_content. Follows from the review discussion
on bnk-forge PR #406.

Bumps module.version 1.0.0 -> 1.0.1 since BlueprintRelease content is
immutable per version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant