[HYPERSHELL-104] feat(kind): add optimized Keycloak image for faster startup - #140
[HYPERSHELL-104] feat(kind): add optimized Keycloak image for faster startup#140rh-amarin wants to merge 1 commit into
Conversation
…startup Add a multi-stage Dockerfile that pre-builds Keycloak providers at image time so `kc.sh build` runs once instead of on every pod start. At runtime Keycloak starts with `--optimized`, cutting startup from ~60s to ~15s. The optimization is opt-in via `KIND_KEYCLOAK_OPTIMIZED=true`. A kustomize overlay (deploy/kind-keycloak-optimized/) layers the optimized patches on top of the stock deploy/kind/ base. `make kind-keycloak-build` allows manual image rebuilds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jsell-rh
left a comment
There was a problem hiding this comment.
PR #140 renders a valid optimized Keycloak overlay and the focused image build/start test succeeds, but the change is not merge-ready. The new Dockerfile violates required dependency pinning, the opt-in behavior contradicts the updated desired-state documentation, and CI does not exercise the enabled path.
Major
-
deploy/kind/keycloak/Dockerfile:1,7— Both base stages use the mutable26.2tag, and the required repository-policy check fails on both lines. Pin both stages to the existing Keycloak digest; confidence: High (100%). -
DEVELOPMENT.md:32,129-135andspecs/platform/local-development.spec.md:30,700,731— These statements say normalmake kind-upuses, builds, and starts the optimized image, whileKIND_KEYCLOAK_OPTIMIZEDdefaults tofalse. Either make optimization the default or qualify the docs/spec everywhere as opt-in; confidence: High (98%). -
scripts/kind/up.sh:243-259— The enabled branch has no automated coverage; the successful E2E check executes the default disabled path. Add a check that renders the overlay and asserts the image, args, and env, plus coverage for selecting the optimized branch; confidence: High (95%).
Minor
- Commit
a37ba61starts with[HYPERSHELL-104]rather than the requiredtype(scope): descriptionform. Rename the squash title to begin withfeat(kind):; confidence: Medium (80%) because recent repository history contains mixed precedent.
Overall assessment: REQUEST_CHANGES
Findings Summary (ordered by severity, highest first):
- [Major] Pin both Keycloak base-image stages by digest - Dependency Pinning (L1, L7)
- [Major] Align unconditional optimized-Keycloak documentation with the opt-in default - Spec Consistency (L32, L129-L135; L30, L700, L731)
- [Major] Add automated coverage for the enabled optimization path - Test Coverage (L243-L259)
- [Minor] Use the required conventional squash-commit title - Commit Discipline (commit a37ba61)
Convention Checklist (omit conventions not applicable to the diff):
| Convention | Result |
|---|---|
| External image dependencies pinned by digest | Fail |
| SecurityContext on all pod specs | Pass |
| Resource limits/requests on containers | Pass |
| Image references consistent across manifests | Pass |
| Conventional commit message | Fail |
| @@ -0,0 +1,11 @@ | |||
| FROM quay.io/keycloak/keycloak:26.2 AS builder | |||
There was a problem hiding this comment.
[Major] Pin both Keycloak base stages. Lines 1 and 7 use the mutable 26.2 tag, so make check fails the required dependency-pin policy. Pin both FROM lines to the existing Keycloak digest, quay.io/keycloak/keycloak:26.2@sha256:e1bea10dc9a144b0f70aba477ba2ef14a0fa752e7e95faa4b7903ffa1287187a. Confidence: High (100%).
|
|
||
| The local Keycloak instance mirrors the downstream Keycloak topology used in | ||
| production. | ||
| production. It uses an optimized image (`deploy/kind/keycloak/Dockerfile`) that |
There was a problem hiding this comment.
[Major] Align this with the opt-in default. KIND_KEYCLOAK_OPTIMIZED defaults to false, so normal make kind-up uses the stock image, but this paragraph, the setup list, and the updated spec state unconditionally that kind-up builds and uses the optimized image. Either change the default to true or qualify every affected statement with KIND_KEYCLOAK_OPTIMIZED=true. Confidence: High (98%).
|
|
||
| # --- Build optimized Keycloak image (optional) --- | ||
| KUSTOMIZE_DIR="deploy/kind" | ||
| if [[ "${KIND_KEYCLOAK_OPTIMIZED:-false}" == "true" ]]; then |
There was a problem hiding this comment.
[Major] Add automated coverage for the enabled path. The successful E2E job executes the default false branch, and no test references this flag or overlay. Add a policy/test check that renders both overlays and asserts the optimized image, start --optimized args, and required env; coverage for branch selection and archive loading would also protect this shell path. The focused manual build/start passed, but regressions here will not be caught. Confidence: High (95%).
Summary
deploy/kind/keycloak/Dockerfile) that pre-builds Keycloak providers at image time, then starts with--optimizedto cut pod startup from ~60s to ~15sKIND_KEYCLOAK_OPTIMIZEDenv var (defaultfalse) using a kustomize overlay (deploy/kind-keycloak-optimized/) on top of the stockdeploy/kind/basemake kind-keycloak-buildtarget for manual image rebuildsTest plan
make kind-up— verify stock Keycloak starts normally (default behavior unchanged)KIND_KEYCLOAK_OPTIMIZED=true make kind-up— verify optimized image is built, loaded, and Keycloak starts with--optimizedin ~15smake kind-keycloak-build— verify manual image rebuild workskustomize build deploy/kind— verify base overlay renders valid YAMLkustomize build deploy/kind-keycloak-optimized— verify optimized overlay renders valid YAML with correct args, env vars, and image overrideJIRA: https://redhat.atlassian.net/browse/HYPERSHELL-104
🤖 Generated with Claude Code