Repository navigation
Conversation
…into a Helm hook Job
Review✅ Certificate key path fix (
|
| Flow | How install.sh is started | ENV_DIR |
|---|---|---|
| Private repo (GitHub Actions) | cd $ENV_FOLDER && bash install.sh ... (ENV_FOLDER=sunbird-spark-installer/opentofu/azure/<env>) |
env folder ✅ |
| Repo cloned on the VM | cd opentofu/azure/<env> && ./install.sh ... |
env folder ✅ |
certkey.pem, certpubkey.pem and the keys in global-values.yaml are written to the same place as before. The old ../opentofu/azure/$environment/ path only resolved correctly after install_component had moved into helmcharts/. The private repo workflow's "Commit certificate keys after learnbb" step, which runs cd $ENV_FOLDER && bash install.sh certificate_keys and then copies $ENV_FOLDER/*.pem, keeps working, and this fixes its Can't open ../opentofu/azure/<env>/certkey.pem error.
Minor: install_component still checks [[ -f "certkey.pem" ]] relative to helmcharts/, where the file never exists, so certificate_keys is always called. It's harmless because certificate_keys skips itself when the keys are already present, but for consistency it should be "$ENV_DIR/certkey.pem".
❌ Changes requested
1. Removing certificate_config breaks the private repo workflow.
sunbird-spark-platform.yaml (step 8 certificate_config) still runs bash install.sh certificate_config, and so does private-repo-setup/README.md. With the function and its case entry commented out, the call falls through to invoke_functions, which fails with "command not found". Please keep a stub, for example:
function certificate_config() {
echo "certificate_config: public key registration now runs as the registry Helm hook (publickey-config-job) — nothing to do"
}2. publickey-config-job.yaml: .Values.publickeyConfig.image will probably fail to render.
publickeyConfig isn't defined in the registry chart's values.yaml. Helm errors with nil pointer evaluating interface {}.image when the parent key is missing, so the learnbb install would fail. Please add publickeyConfig.image to the values, or use (.Values.publickeyConfig | default dict).image. Please also pin the image tag instead of curlimages/curl:latest, and add it to images.yaml.
3. The public key reaches registry in a different format than before.
CERTIFICATE_PUBLIC_KEY is stored in global-values.yaml as "-----BEGIN PUBLIC KEY-----\nMIIB...\n-----END PUBLIC KEY-----\n", so Helm reads it with real newlines. In value: "{{ .Values.global.CERTIFICATE_PUBLIC_KEY }}" the rendered string spans several lines, and when Kubernetes parses the YAML it turns those line breaks into spaces. Checked with a parser:
| Registry receives | |
|---|---|
Old certificate_config |
-----BEGIN PUBLIC KEY-----⏎MIIB...⏎-----END PUBLIC KEY----- |
| This PR | -----BEGIN PUBLIC KEY----- MIIB... -----END PUBLIC KEY----- |
Fix: use the \\n-escaped copy of the same key, in single quotes, so the env var keeps the literal \n and the JSON payload matches the old one exactly:
env:
- name: CERTIFICATE_PUBLIC_KEY
value: '{{ .Values.global.CERTIFICATESIGN_PUBLIC_KEY }}'4. The hook can report success without registering the key.
The Job runs right after install with no wait for registry-service. If registry isn't ready, the search returns empty, the POST fails, and curl without -f still exits 0, so the Job succeeds and nothing is registered. Please add a wait-until-ready loop and use curl -f, so a failure is visible.
5. ysql.yaml backoffLimit.
The Job has backoffLimit: 0 under spec and backoffLimit: 30 at the end. Removing the 30 leaves the migration Job with 0 retries. If 30 was what applied before, that's a behaviour change. Should we keep 30 and drop the 0 instead?
Since items 2–4 only show up on a real learnbb install, please do one test deploy before merging. If the path fix is needed quickly, it's safe to split it into its own PR.
There was a problem hiding this comment.
Re-review (after 8b47fa33 "cert_sign_config added")
Thanks for bringing certificate_config back and dropping the hook Job. That resolves the earlier points about the private repo workflow, the README, ./install.sh certificate_config on the VM, publickeyConfig.image, the PEM newline format (the payload is the same awk extraction as before, so the format matches), and the silent-success hook. Running curl/jq on the host through a port-forward is a good approach.
❌ Blocker: the RETURN trap kills install.sh with exit 143
trap 'kill $pf_pid 2>/dev/null; wait $pf_pid 2>/dev/null' RETURNWhen the function returns, kill sends SIGTERM to the port-forward, and wait $pf_pid then returns 143 (128 + SIGTERM). Because the script runs with set -euo pipefail, that non-zero status in the trap exits the whole script with 143, even when the key was registered successfully.
Reproduced on bash 5.2.21 (Ubuntu 24.04) with a minimal script using the same set -euo pipefail and the same trap line: output stopped right after the function returned, exit=143.
Impact:
- Full install (
./install.shwith no args): stops aftercertificate_config.dns_mapping,generate_postman_envandrun_post_installnever run. - Private repo workflow step 8 (
bash install.sh certificate_config) always fails.
Fix (verified with the same test: the script continues, exit=0). It also clears the trap so it doesn't fire on later function returns:
trap 'kill $pf_pid 2>/dev/null; wait $pf_pid 2>/dev/null || true; trap - RETURN' RETURNSmaller points on certificate_config
- Fixed local port 8081. If something on the runner already uses 8081 (another port-forward, a local service), either the port-forward dies, which is handled, or the readiness check gets an answer from the other process and the calls go to the wrong place. Let kubectl choose a free port:
kubectl port-forward svc/registry-service :8081and read the port from its output, or use a less common fixed port. - Empty key check. If
CERTIFICATE_PUBLIC_KEYis missing fromglobal-values.yaml,CERTPUBKEYis empty and an empty key is registered, after which the search check skips it forever. Add[[ -n "$CERTPUBKEY" ]] || { echo "CERTIFICATE_PUBLIC_KEY not found in global-values.yaml"; return 1; }. - Use
"$ENV_DIR/global-values.yaml"in theawk, to match thecertificate_keyschange in this PR. /tmp/certcfg-pf-$$.logis never removed. Addrm -f "$pf_log"to the trap.
Still open from the first review
- GCP not updated.
opentofu/gcp/template/install.shstill has the oldkubectl exec deploy/knowledge-mw+apt-get install jqversion, so GCP has the same DHI-image failure this PR fixes for Azure. Please port the new function there too. ysql.yamlbackoffLimit. The PR removesbackoffLimit: 30and keepsbackoffLimit: 0, so the migration Job gets no retries. Was that intended? Keeping 30 and dropping 0 seems safer.
✅ Unchanged and fine
ENV_DIRcertificate key paths: correct for both the private repo workflow and running on the VM.node:18.20.8-bookworm.- The
ysql.yamlwait command fix (sleep 10, stray quotes removed).
Requesting changes for the trap blocker. The rest are small. After the fix, one full ./install.sh run (or at least install_component learnbb followed by certificate_config and dns_mapping) on a test environment would confirm it end to end.
|
divyagovindaiah
left a comment
There was a problem hiding this comment.
Re-review (after a38d7760 "updated cert_config, ysql to 30 retries")
Correction to my earlier comments: disabling ai_pipeline_enabled in the template was requested, so please ignore that point. I've removed it from the earlier reviews.
✅ Resolved in this commit
ysql.yaml:backoffLimit: 30, and only onebackoffLimitremains. 👍- Port-forward readiness: checking for
Forwarding fromin the port-forward log confirms our port-forward is the one listening, so a different process on 8081 can no longer be mistaken for registry. If 8081 is busy, kubectl exits with "address already in use" and thekill -0check catches it. Good enough to keep the fixed port.
❌ Still blocking: the RETURN trap exits install.sh with 143
This line is unchanged:
trap 'kill $pf_pid 2>/dev/null; wait $pf_pid 2>/dev/null' RETURNWhen certificate_config returns, wait reports the killed port-forward as 143, and with set -euo pipefail that ends the whole script with exit 143, even after a successful registration. Reproduced on bash 5.2.21 (Ubuntu 24.04).
- Full
./install.sh: stops aftercertificate_config.dns_mapping,generate_postman_envandrun_post_installnever run. - Private repo workflow step
bash install.sh certificate_config: always fails.
One-line fix (verified: the script continues, exit 0):
trap 'kill $pf_pid 2>/dev/null; wait $pf_pid 2>/dev/null || true; rm -f "$pf_log"; trap - RETURN' RETURNThis also cleans up the temp log and clears the trap so it doesn't run again on later function returns.
Still open (non-blocking)
- Empty key guard. If
CERTIFICATE_PUBLIC_KEYisn't inglobal-values.yaml, an empty key gets registered and the search check skips it from then on:[[ -n "$CERTPUBKEY" ]] || { echo "CERTIFICATE_PUBLIC_KEY not found in global-values.yaml"; return 1; }
- Use
"$ENV_DIR/global-values.yaml"in theawk, to match thecertificate_keyschange. - GCP:
opentofu/gcp/template/install.shstill has the oldkubectl exec deploy/knowledge-mwversion. Please port the new function so GCP doesn't hit the same DHI-image failure.
Once the trap line is fixed, I'm happy to approve. Items 1–3 can go in this PR or a quick follow-up.
|
Re-review (after
|
| # | Item | Status |
|---|---|---|
| 1 | RETURN trap exiting install.sh with 143 |
✅ Fixed: wait ... || true and trap - RETURN added (Azure and GCP) |
| 2 | Temp port-forward log not cleaned up | ✅ Fixed: rm -f "$pf_log" in the trap |
| 3 | Empty key registered when CERTIFICATE_PUBLIC_KEY missing |
✅ Fixed: guard added before the POST |
| 4 | awk reading global-values.yaml relative to cwd |
✅ Fixed: now "$ENV_DIR/global-values.yaml" |
| 5 | GCP still using kubectl exec deploy/knowledge-mw |
✅ Fixed: GCP now has the same port-forward certificate_config, wired into the default flow and the case entry |
| 6 | ysql.yaml migration Job retries |
✅ Fixed: backoffLimit: 30 (single key) |
| 7 | Port-forward readiness check | ✅ Fixed (previous commit): waits for Forwarding from in the port-forward log |
Both install.sh files pass bash -n.
One more fix neededThe problemThis PR changes the wait command inside the YugabyteDB migration Job ( On an environment where learnbb is already installed, that Job already exists in the cluster. Kubernetes does not allow the command of an existing Job to be changed, so Fresh installs are fine. Only upgrades of existing environments fail. What to changeIn both kubectl delete job learnbb-yugabytesql-migration-job -n sunbird --ignore-not-foundSo the block becomes: if [[ $component = "learnbb" ]]; then
if kubectl get job keycloak-kids-keys -n sunbird >/dev/null 2>&1; then
echo "Deleting existing job keycloak-kids-keys..."
kubectl delete job keycloak-kids-keys -n sunbird
fi
kubectl delete job learnbb-yugabytesql-migration-job -n sunbird --ignore-not-found
...Helm then creates the Job again with the new command. Running the migration again is safe (the SQL files are applied with Optional (nice to have)
|
|
Re-review (after
|
| # | Item | Status |
|---|---|---|
| 1 | Delete learnbb-yugabytesql-migration-job before installing learnbb (Job template is immutable) |
✅ Fixed in Azure and GCP install.sh |
| 2 | Error message when the registry PublicKey search fails | ✅ Fixed in Azure and GCP |
| 3 | ai-pipeline comment in create_tf_resources starting mid-sentence |
✅ Fixed |
Both install.sh files pass bash -n. Nit: the blank line added above the new kubectl delete job line has trailing spaces.
|



What changed
Four independent fixes, all found and confirmed by reproducing real failures from the ey-installer GitHub Actions deployment history (18 failed runs reviewed):
Touches: OpenTofu modules (Azure + GCP), Helm charts (learnbb)
Providers affected: Azure, GCP
Why
Multiple real deployments against ey-installer's self-hosted CI runner failed on these exact errors — fixing them here so they don't recur anywhere else using this installer.
How this was verified