Skip to content

Claude/kubernetes migration plan kq jw d#358

Open
t0mdavid-m wants to merge 13 commits intomainfrom
claude/kubernetes-migration-plan-KQJwD
Open

Claude/kubernetes migration plan kq jw d#358
t0mdavid-m wants to merge 13 commits intomainfrom
claude/kubernetes-migration-plan-KQJwD

Conversation

@t0mdavid-m
Copy link
Copy Markdown
Member

@t0mdavid-m t0mdavid-m commented Apr 2, 2026

Summary by CodeRabbit

  • New Features
    • Added a Traefik route for the Streamlit app with sticky sessions (cookie-based) to improve session persistence and routing.
  • Chores
    • Updated Streamlit and worker deployments to use the correct Redis connection URL so the app and background workers connect reliably.

claude and others added 11 commits March 5, 2026 19:58
Decompose the monolithic Docker container into Kubernetes workloads:
- Streamlit Deployment with health probes and session affinity
- Redis Deployment + Service for job queue
- RQ Worker Deployment for background workflows
- CronJob for workspace cleanup
- Ingress with WebSocket support and cookie-based sticky sessions
- Shared PVC (ReadWriteMany) for workspace data
- ConfigMap for runtime configuration (replaces build-time settings)
- Kustomize base + template-app overlay for multi-app deployment

Code changes:
- Remove unsafe enableCORS=false and enableXsrfProtection=false from config.toml
- Make workspace path configurable via WORKSPACES_DIR env var in clean-up-workspaces.py

CI/CD:
- Add build-and-push-image.yml to push Docker images to ghcr.io
- Add k8s-manifests-ci.yml for manifest validation and kind integration tests

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
kustomization.yaml is a Kustomize config file, not a standard K8s resource,
so kubeconform has no schema for it. Exclude it via -ignore-filename-pattern.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
The integration-test job now uses a matrix with Dockerfile_simple and
Dockerfile. Each matrix entry checks if its Dockerfile exists before
running — all steps are guarded with an `if` condition so they skip
gracefully when a Dockerfile is absent. This allows downstream forks
that only have one Dockerfile to pass CI without errors.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
- Switch workspace PVC from ReadWriteMany to ReadWriteOnce with
  cinder-csi storage class (required by de.NBI KKP cluster)
- Increase PVC storage to 500Gi
- Add namespace: openms to kustomization.yaml
- Reduce pod resource requests (1Gi/500m) and limits (8Gi/4 CPU)
  so all workspace-mounting pods fit on a single node

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
The workspaces PVC uses ReadWriteOnce (Cinder CSI block storage) which
requires all pods mounting it to run on the same node. Without explicit
affinity rules, the scheduler was failing silently, leaving pods in
Pending state with no events.

Adds a `volume-group: workspaces` label and podAffinity with
requiredDuringSchedulingIgnoredDuringExecution to streamlit deployment,
rq-worker deployment, and cleanup cronjob. This ensures the scheduler
explicitly co-locates all workspace-consuming pods on the same node.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
The controller pod being Ready doesn't guarantee the admission webhook
service is accepting connections. Add a polling loop that waits for the
webhook endpoint to have an IP assigned before applying the Ingress
resource, preventing "connection refused" errors during kustomize apply.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
The kustomize overlay deploys into the openms namespace, but the
verification steps (Redis wait, Redis ping, deployment checks) were
querying the default namespace, causing "no matching resources found".

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
Replace the unreliable endpoint-IP polling with a retry loop on
kubectl apply (up to 5 attempts with backoff). This handles the race
where the ingress-nginx admission webhook has an endpoint IP but isn't
yet accepting TCP connections.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
Kustomize namePrefix renames the Redis service to template-app-redis,
but the REDIS_URL env var in streamlit and rq-worker deployments still
referenced the unprefixed name "redis", causing the rq-worker to
CrashLoopBackOff with "Name or service not known".

Add JSON patches in the overlay to set the correct prefixed hostname.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Warning

Rate limit exceeded

@t0mdavid-m has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 56 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 56 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6f894002-6f4b-4c56-aca0-0ecc6ae6feab

📥 Commits

Reviewing files that changed from the base of the PR and between 443ae24 and 9c0fa08.

📒 Files selected for processing (1)
  • .github/workflows/k8s-manifests-ci.yml
📝 Walkthrough

Walkthrough

The repo adds a Traefik IngressRoute resource and updates a Kustomize overlay to apply JSON patches that change the first container's first env value in the streamlit and rq-worker Deployments to redis://template-app-redis:6379/0.

Changes

Cohort / File(s) Summary
Overlay: Deployment JSON patches
k8s/overlays/template-app/kustomization.yaml
Added JSON6902 patches targeting Deployment/streamlit and Deployment/rq-worker to replace /spec/template/spec/containers/0/env/0/value with redis://template-app-redis:6379/0.
Base: Kustomization updated
k8s/base/kustomization.yaml
Added traefik-ingressroute.yaml to the resources list.
Base: Traefik IngressRoute
k8s/base/traefik-ingressroute.yaml
New Traefik IngressRoute streamlit-traefik on entryPoint web, matching PathPrefix(\/`), forwarding to service streamlit:8501with sticky cookiestroute (httpOnly: true, sameSite: lax`).

Possibly related PRs

Poem

🐰 A little patch beneath the leaves,
Redis routes hum as sunlight weaves,
Traefik guides the streaming flow,
Cookies stick where sessions go,
Hoppity hops — deployments grow! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Claude/kubernetes migration plan kq jw d' is vague and appears to include random characters or identifiers (kq jw d) that don't clarify the specific changes made to the Kubernetes configuration. Revise the title to be more specific about the main changes, such as 'Add Traefik IngressRoute and update Redis environment variables' or 'Configure Traefik routing and Redis connection for template-app deployment'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/kubernetes-migration-plan-KQJwD

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
k8s/overlays/template-app/kustomization.yaml (1)

25-38: Add test operations to precondition JSON patches for robustness.

The patches rely on env/0 index, which is order-sensitive. Add test ops before each replace to verify REDIS_URL is at that index; this ensures patching fails fast with a clear error if the environment variable array structure changes.

Suggested diff
   - target:
       kind: Deployment
       name: streamlit
     patch: |
+      - op: test
+        path: /spec/template/spec/containers/0/env/0/name
+        value: REDIS_URL
       - op: replace
         path: /spec/template/spec/containers/0/env/0/value
         value: "redis://template-app-redis:6379/0"
   - target:
       kind: Deployment
       name: rq-worker
     patch: |
+      - op: test
+        path: /spec/template/spec/containers/0/env/0/name
+        value: REDIS_URL
       - op: replace
         path: /spec/template/spec/containers/0/env/0/value
         value: "redis://template-app-redis:6379/0"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@k8s/overlays/template-app/kustomization.yaml` around lines 25 - 38, The JSON
patches in kustomization.yaml for the Deployment targets "streamlit" and
"rq-worker" currently replace /spec/template/spec/containers/0/env/0/value
assuming env[0] is REDIS_URL; add a preceding "test" op for each replace that
asserts /spec/template/spec/containers/0/env/0/name equals "REDIS_URL" (so the
patch fails clearly if ordering changed), then perform the existing replace of
/spec/.../env/0/value with the new redis URL; update both target blocks
(Deployment name: streamlit and Deployment name: rq-worker) to include these
test operations immediately before their replace ops.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@k8s/overlays/template-app/kustomization.yaml`:
- Around line 25-38: The JSON patches in kustomization.yaml for the Deployment
targets "streamlit" and "rq-worker" currently replace
/spec/template/spec/containers/0/env/0/value assuming env[0] is REDIS_URL; add a
preceding "test" op for each replace that asserts
/spec/template/spec/containers/0/env/0/name equals "REDIS_URL" (so the patch
fails clearly if ordering changed), then perform the existing replace of
/spec/.../env/0/value with the new redis URL; update both target blocks
(Deployment name: streamlit and Deployment name: rq-worker) to include these
test operations immediately before their replace ops.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5066100a-8395-46f2-8e7c-36fce8229010

📥 Commits

Reviewing files that changed from the base of the PR and between 6a2bc03 and d144aeb.

📒 Files selected for processing (1)
  • k8s/overlays/template-app/kustomization.yaml

claude added 2 commits April 2, 2026 13:55
The cluster uses Traefik, not nginx, so the nginx Ingress annotations
are ignored. Add a Traefik IngressRoute with PathPrefix(/) catch-all
routing and sticky session cookie for Streamlit session affinity.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
…ests

kubeconform doesn't know the Traefik IngressRoute CRD schema, and the
kind cluster in integration tests doesn't have Traefik installed. Skip
the IngressRoute in kubeconform validation and filter it out with yq
before applying to the kind cluster.

https://claude.ai/code/session_01RNJ3dVjV1VTHcC9ugE3FQJ
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