Fix reconcile crash when Keycloak detection tasks are skipped#2
Open
fabianvf wants to merge 2 commits into
Open
Fix reconcile crash when Keycloak detection tasks are skipped#2fabianvf wants to merge 2 commits into
fabianvf wants to merge 2 commits into
Conversation
6c652e9 to
d9c8aae
Compare
The "Set federated IDP issuer" set_fact guarded the conditionally- registered rhsso_keycloak_cr / rhbk_keycloak_cr vars with `is defined`. Those k8s_info tasks only run `when: app_profile == 'mta'`; on other profiles they are skipped, but a skipped task still registers a result dict that has no `.resources` key. `is defined` is True for that dict, so the template then evaluated `.resources` and failed with "'dict object' has no attribute 'resources'", aborting the reconcile before any workloads were created. Keep the `is defined` guard (short-circuits a genuinely undefined var) and add `default([])` on `.resources` so the skipped-register case (defined dict, missing attribute) collapses to an empty list. Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
"Set app base URL from UI Ingress" (and the matching Hub OIDC issuer task) read ui_ingress_info.resources[0].spec.rules[0].host, guarded only by `resources | length > 0`. The default UI Ingress (ingress-ui.yml.j2) defines a host-less rule (`- http:` with no `host:`), so on any non-OpenShift cluster (e.g. minikube CI) the rule exists but has no `host` key, and the template failed with "'dict object' has no attribute 'host'", aborting the reconcile before llm-proxy / kai-db were created. Add a `...rules[0].host is defined` guard to both tasks so a host-less Ingress leaves app_base_url / hub_oidc_issuer at their defaults instead of crashing. Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>
d9c8aae to
cbf154e
Compare
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.
Problem
The
llm-proxy-testCI on konveyor#562 fails during reconcile (run 26526639422). The Tackle CR never becomes ready, and no hub/ui/kai-db/llm-proxy workloads are created — the playbook aborts early:Root cause
The
Set federated IDP issuerset_fact guards the conditionally-registeredrhsso_keycloak_cr/rhbk_keycloak_crvars withis defined. Those twok8s_infotasks only runwhen: app_profile == 'mta'. On other profiles (CI runs thekonveyorprofile) they are skipped — but a skipped task still registers a result dict, one that has no.resourceskey.So
rhsso_keycloak_cr is definedisTrue(it's the skip-result dict), the template proceeds to evaluate.resources, and Jinja raises'dict object' has no attribute 'resources'. The earlier branches are all false in CI (keycloak_sso_url/rhbk_urlempty, no standalone Keycloak service), so execution always reaches the brokenelif.Fix
Keep the
is definedguard — it short-circuits a genuinely undefined var (andandshort-circuits in Jinja, so.resourcesis never evaluated in that case) — and adddefault([])on the attribute so the skipped-register case (defined dict, missing.resources) collapses to an empty list:(
default([])alone is not enough: it only rescues the missing-attribute case. If the base var were ever fully undefined, evaluating.resourceson it would raise before the filter runs — hence keepingis defined.)standalone_keycloak_svcneeds no change — that task always runs, so it always has.resources.Test plan
llm-proxy-test(and the other install jobs) on ✨ Keycloak dependency removed. konveyor/operator#562 get past the reconcile and create all workloads