Skip to content

Pr/deploy on kind fixes - #4390

Open
cyrano-janus wants to merge 9 commits into
cloudfoundry:mainfrom
cyrano-janus:pr/deploy-on-kind-fixes
Open

Pr/deploy on kind fixes#4390
cyrano-janus wants to merge 9 commits into
cloudfoundry:mainfrom
cyrano-janus:pr/deploy-on-kind-fixes

Conversation

@cyrano-janus

Copy link
Copy Markdown

+# PR: fix(deploy-on-kind): make fresh deployments work reliably
+
+Title: fix(deploy-on-kind): make fresh deployments work reliably
+
+Base: mainCompare: cyrano-janus:pr/deploy-on-kind-fixes
+
+---
+
+## Description
+
+While deploying Korifi on a fresh kind cluster we hit several issues in
+scripts/deploy-on-kind.sh. This PR fixes them incrementally (8 small
+commits) and adds fail-fast preflight checks plus an end-to-end smoke test,
+so failures surface with actionable messages instead of cryptic kpack/EOF
+errors minutes later.
+
+## Fixes
+
+1. chart_dir scope bug: helm upgrade referenced $chart_dir /

  • $values_file unconditionally, but both were only set inside the
  • docker-build branch → script crashed when run with SKIP_DOCKER_BUILD=1.
  • The chart dir is now always prepared; SKIP_DOCKER_BUILD only skips kbld
  • image resolution and kind load.

+2. VERSION fallback: git describe --tags --long fails on shallow

  • clones or repos without tags, killing the script under set -e.
  • Falls back to the short commit SHA.

+3. shellcheck SC2064: single-quote the RETURN-trap command so

  • $chart_dir expands at signal time, not at trap registration.

+4. set -u vs RETURN trap: the trap variable must not be local — by the

  • time the trap fires the local is gone and set -u aborts cleanup with
  • chart_dir: unbound.

+5. shellcheck SC2155: declare-and-assign separately for VERSION so a

  • failing git describe cannot be masked by export's exit code.

+6. Registry preflight: after deploying the local registry, poll it from

  • inside the kind node (curl -u user:password http://127.0.0.1:30050/v2/)
  • and fail fast with a clear message instead of later kpack build failures.
  • The kind node has no cluster DNS, hence 127.0.0.1.

+7. Configurable API FQDN (API_SERVER_FQDN, default localhost):

  • feeds the Gateway https-api listener hostname, the API's externalFQDN and
  • the generated ingress cert SAN. Reaching the API under any other name
  • caused SNI mismatch / connection EOF. Also adds a DNS-resolution preflight
  • that prints the exact /etc/hosts line when the name does not resolve.

+8. API smoke test: at the end of the deploy, poll

  • https://<fqdn>:<port>/v3/info through the kind hostPort mapping; on
  • failure print concrete troubleshooting hints (Gateway listener hostname,
  • TLSRoute, port mappings), on success print ready-to-use cf api /
  • cf auth commands.

+## Testing
+
+- bash -n, shellcheck 0.10 (-S warning), shfmt -d -i 2 -ci: clean
+- Fresh kind cluster from scratch with `SKIP_DOCKER_BUILD=1

  • API_SERVER_FQDN=api.korifi.local ./scripts/deploy-on-kind.sh korifi`:
  • exit 0, smoke test passed
    +- Full workflow verified end to end: cf apicf auth cf-admin admin
  • cf create-org/spacecf push of a Go app → app reachable via route
    +- Idempotent re-run of the script against an existing cluster: exit 0

+## Notes
+
+- Default behaviour (API_SERVER_FQDN=localhost) is unchanged, so CI flows

  • are unaffected.
    +- Happy to split this into separate PRs if preferred — commits are already
  • logically grouped.

…ILD block

helm upgrade referenced $chart_dir and $values_file unconditionally,
but both were only set inside the docker-build branch. Running with
SKIP_DOCKER_BUILD=1 crashed with an empty chart path.

Now the chart dir is always prepared; SKIP_DOCKER_BUILD just skips
kbld image resolution and kind load. helm dependency update now runs
against the copied chart dir instead of helm/korifi.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
git describe --tags --long fails on shallow clones or repos without
tags, killing the whole script under set -e. Fall back to the short
commit SHA as chart version.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
- trap: single-quote the cleanup command so $chart_dir expands at
  signal time, not at trap registration (SC2064)
- VERSION: declare and assign separately so a failing git describe
  cannot be masked by export's return code (SC2155)

Signed-off-by: CyEs <cyrano.janus@gmail.com>
The SC2064 fix made the trap expand $chart_dir at signal time, but the
variable was local to deploy_korifi — by the time the RETURN trap fires
the local is gone and set -u aborts with 'chart_dir: unbound'. Drop
'local' so the quoted expansion inside the trap still resolves.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
A broken or auth-misconfigured registry only surfaced much later as
cryptic kpack build failures (EOF, 401). Poll the registry from inside
the kind node (curl against 127.0.0.1:30050, node has no cluster DNS)
and fail fast with a clear message if it is not reachable or the
user/password credentials are rejected.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
api.apiServer.url feeds three places: the Gateway https-api listener
hostname, the korifi-api externalFQDN and the generated ingress cert
SAN. Hardcoding 'localhost' causes SNI mismatches (connection EOF)
for anyone reaching the API under a different name such as
api.korifi.local.

Default remains 'localhost' so upstream CI behaviour is unchanged;
override with API_SERVER_FQDN=api.korifi.local to match an /etc/hosts
entry.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
A missing /etc/hosts entry for the API FQDN surfaces to users as a
confusing connection EOF from cf/curl. Verify resolution via getent
at the end of the deploy and print the exact fix instead. Skipped for
the default localhost setup.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
After deploying, poll https://<fqdn>:<port>/v3/info through the kind
hostPort mapping and fail with concrete troubleshooting hints if the
API is not reachable. On success print the cf api / cf auth commands.
FQDN and port default to localhost:443 and are read from the same
API_SERVER_FQDN / API_SERVER_PORT env vars used elsewhere.

Signed-off-by: CyEs <cyrano.janus@gmail.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 23, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

kind's --wait 5m flag times out intermittently in our test environment,
leaving the script in a half-deployed state. Replace it with a 0m wait
plus a manual loop that polls for node Ready state with 10s intervals
up to ~5min. This is functionally equivalent but exits cleanly on
success and on timeout, so the rest of the script can proceed or abort.

Refs: tracking issue with kind timeout on Korifi deploys.
@danail-branekov

Copy link
Copy Markdown
Member

Hi @cyrano-janus

Korifi project is currently being archived, see RFC 0060. The repo archival is pending. Provided that the CI infrastructure is already down, I am afraid your PR cannot be merged.

FWIW, we have never advertised deploy-on-kind to be the official way of installing korifi on kind. It is just a dev tool we use daily to bring up local test/dev environment. Therefore we have always tried to keep it lean (even at the cost of cryptic errors) and just good enough for our daily job. We never meant the script to be robust in any way

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.

2 participants