Repository navigation
feat: add a Helm chart and document deployment - #92
Conversation
Add a chart in deployment/ for Kubernetes and OpenShift: Deployment, Service, and an Ingress, Gateway API HTTPRoute or OpenShift Route, with an optional NetworkPolicy and PodDisruptionBudget. Settings come from camelCase values, the login providers only from an existing Secret; rendering fails without host, registry or Secret. The pod runs non-root with a read-only root file system; on OpenShift, user IDs and the seccomp profile are left to the cluster. CI lints and tests the chart (job chart) and installs it on kind with helm test (job chart-install); both are in the gate's needs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add "Helm chart" to the operator guide: installation from a release's checkout, the login providers' Secret and its fields, all values, exposing Krini, security on Kubernetes and OpenShift, upgrades and the chart tests. Link it from the README's quick start, the deployment and upgrade pages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Admit the helm test pod through the NetworkPolicy. - No default ClusterIssuer: it's specific to a cluster. - Standard labels on pods; the version label follows krini.tag. - One helper for the port; value checks in their own template. - Run the ERR trap of the install script inside functions too. - Document that OpenShift needs the Ingress disabled for the Route, and the annotations and security contexts; more chart tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Allow `global` again, so that the chart works as a subchart. - Take the version label from krini.tag or the tag in krini.image, leave it out for digests, and keep it a valid label value. - Warn in the notes when OpenShift would serve the Ingress without TLS. - Check all labels of the test pod against the NetworkPolicy; rewrap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideAPIDefine the chart’s public values and validation rules, including required deployment settings and the supported configuration options.
ConfigurationImplement the Helm chart resources and helper logic that render the deployment, networking, exposure, and test-hook manifests from the chart values.
Set chart metadata and package contents, and update repository build-context exclusions for the new deployment directory.
Add CI jobs for chart lint/render tests and kind installation, and require them in the image-publish and overall-result gates.
Register the new Helm chart page in the documentation site navigation.
DocumentationDocument the chart’s installation, values, secret handling, exposure options, security, operations, and testing, and add chart-specific repository guidance.
Link the Helm deployment path from the project quick start and existing operator guidance.
TestsAdd render-level chart checks for expected resources and validation failures, plus a cluster-install script that tests the release and upgrade behavior.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #92 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 19
Lines 545 545
Branches 157 157
=========================================
Hits 545 545 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 3a57694 #52 feat: add a Helm chart and document deployment · 7 of 8 met
|
There was a problem hiding this comment.
Hey - I've found 13 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="deployment/templates/networkpolicy.yaml" line_range="12-13" />
<code_context>
+*/ -}}
+{{- $policy := .Values.krini.networkPolicy -}}
+{{- if $policy.enabled -}}
+{{- if not $policy.ingressFrom -}}
+{{- fail "krini.networkPolicy.ingressFrom must list at least one NetworkPolicy peer (no peers would allow all sources), e.g., the pods of the ingress controller or Gateway; set krini.networkPolicy.enabled to false to allow all sources" -}}
+{{- end -}}
+apiVersion: networking.k8s.io/v1
</code_context>
<issue_to_address>
**Empty peer admits all traffic**
When `krini.networkPolicy.enabled` is true and `krini.networkPolicy.ingressFrom` contains `{}`, the check only rejects an empty `ingressFrom` list; a peer with no selectors renders as an unrestricted source, so the NetworkPolicy allows connections from any source on Krini's port despite appearing enabled.
Reject peers without a `podSelector`, `namespaceSelector` or `ipBlock` before rendering the policy.
</issue_to_address>
### Comment 2
<location path="deployment/templates/networkpolicy.yaml" line_range="31-35" />
<code_context>
+ labels:
+ {{- include "krini.labels" . | nindent 4 }}
+spec:
+ podSelector:
+ matchLabels:
+ {{- include "krini.selectorLabels" . | nindent 6 }}
+ policyTypes:
+ - Ingress
+ ingress:
+ - from:
+ {{- toYaml $policy.ingressFrom | nindent 4 }}
+ # The test pod of `helm test`
+ - podSelector:
+ matchLabels:
+ app.kubernetes.io/name: {{ include "krini.name" . | quote }}
+ app.kubernetes.io/instance: {{ .Release.Name | quote }}
+ app.kubernetes.io/component: test
+ ports:
+ - port: {{ include "krini.port" . }}
</code_context>
<issue_to_address>
**Same-namespace pods bypass ingress allowlist**
When a tenant who can create pods in the release namespace creates one with the matching test labels, the NetworkPolicy admits any pod carrying the `app.kubernetes.io/name`, `app.kubernetes.io/instance` and `app.kubernetes.io/component: test` labels, so that pod can reach Krini on port 3000 even when it is not in `ingressFrom`; the caller sees the allowlist bypassed.
Do not use forgeable pod labels as an authorization exception; remove the test-pod peer and arrange test connectivity through an explicitly trusted path.
Also at `deployment/templates/tests/test-connection.yaml:12-13`.
</issue_to_address>
### Comment 3
<location path="deployment/templates/deployment.yaml" line_range="10" />
<code_context>
+ labels:
+ {{- include "krini.labels" . | nindent 4 }}
+spec:
+ replicas: {{ $values.replicas }}
+ revisionHistoryLimit: 10
+ selector:
</code_context>
<issue_to_address>
**Concurrent refreshes log users out**
When the chart is configured with multiple replicas and two browser tabs concurrently refresh the same rotating refresh token, with the requests handled by different pods, the successful pod records the old refresh token only in its process-local `recentRefreshSuccess` map; the other pod's replay-401 handler finds no record and deletes the authentication cookies, so the browser loses its session.
Coordinate refresh outcomes across replicas or change the replay-401 handling so one pod cannot invalidate cookies after another pod succeeds.
</issue_to_address>
### Comment 4
<location path="deployment/templates/_helpers.tpl" line_range="112-116" />
<code_context>
+Route or a proxy in front of the cluster.
+*/}}
+{{- define "krini.appOrigin" -}}
+{{- $origin := .Values.config.appOrigin -}}
+{{- if not $origin -}}
+{{- $hostName := required "hostName or config.appOrigin must be set: Krini sends users back to its origin after the login (APP_ORIGIN)" .Values.hostName -}}
+{{- $origin = printf "https://%s" $hostName -}}
+{{- end -}}
+{{- $origin -}}
+{{- end -}}
</code_context>
<issue_to_address>
**HTTP URLs break login and privacy links**
When config.appOrigin or either privacy URL is set to an http:// URL, the chart passes `config.appOrigin` through as `APP_ORIGIN`, so Krini redirects to HTTP while production cookies are secure and users cannot complete login. It also passes HTTP privacy URLs through, but `privacySettings` returns `null` for them, so the configured links are absent.
Reject HTTP values for `config.appOrigin` and both privacy URL settings.
Also at `deployment/templates/_helpers.tpl:134-135`.
</issue_to_address>
### Comment 5
<location path="deployment/templates/_helpers.tpl" line_range="112-117" />
<code_context>
+Route or a proxy in front of the cluster.
+*/}}
+{{- define "krini.appOrigin" -}}
+{{- $origin := .Values.config.appOrigin -}}
+{{- if not $origin -}}
+{{- $hostName := required "hostName or config.appOrigin must be set: Krini sends users back to its origin after the login (APP_ORIGIN)" .Values.hostName -}}
+{{- $origin = printf "https://%s" $hostName -}}
+{{- end -}}
+{{- $origin -}}
+{{- end -}}
+
</code_context>
<issue_to_address>
**App origin paths break API requests**
When config.appOrigin includes a path or trailing slash, krini uses the raw value when constructing an internal API URL, while its OIDC helper strips the path to the URL origin; the service-info page also appends its API path to the raw value. The resulting URLs do not match the app's API route, so API requests fail.
Normalize `config.appOrigin` to the URL origin before passing it to the app.
</issue_to_address>
### Comment 6
<location path="deployment/templates/_helpers.tpl" line_range="201" />
<code_context>
+emptyDir: {}
+{{- else -}}
+emptyDir:
+ sizeLimit: {{ ternary . (int64 . | toString) (kindIs "string" .) | quote }}
+{{- end -}}
+{{- end -}}
</code_context>
<issue_to_address>
**Zero cache limit passes validation**
When `krini.tmpSizeLimit` is supplied as the string `"0"` (or another zero quantity such as `"0Mi"`), the template emits `tmpSizeLimit: "0"` as the emptyDir limit; Kubernetes then has no usable space for Next.js cache writes, breaking cache-dependent requests and potentially evicting the pod.
Reject zero-valued string quantities in the schema or validate that `tmpSizeLimit` is strictly positive before rendering.
</issue_to_address>
### Comment 7
<location path="deployment/templates/deployment.yaml" line_range="36" />
<code_context>
+ containers:
+ - name: krini
+ image: {{ include "krini.image" . | quote }}
+ imagePullPolicy: {{ $values.imagePullPolicy | default "Always" }}
+ env:
+ {{- include "krini.env" . | trim | nindent 8 }}
</code_context>
<issue_to_address>
**Moving tags leave old pods running**
When the image behind a mutable tag changes but the Helm upgrade renders an unchanged pod template, kubernetes does not restart a Deployment just because a mutable tag now points to a new image. With the default `dev` tag, an upgrade that leaves the rendered pod template unchanged keeps serving the old image; `imagePullPolicy: Always` only pulls the latest image when a container starts.
Provide an explicit rollout mechanism for mutable tags, or document that operators must restart the Deployment after the image is updated.
</issue_to_address>
### Comment 8
<location path="deployment/templates/tests/test-connection.yaml" line_range="10-16" />
<code_context>
+apiVersion: v1
+kind: Pod
+metadata:
+ name: {{ printf "%s-test" (include "krini.fullname" . | trunc 58 | trimSuffix "-") | quote }}
+ labels:
+ {{- include "krini.baseLabels" . | nindent 4 }}
+ app.kubernetes.io/component: test
+ annotations:
+ helm.sh/hook: test
+ helm.sh/hook-delete-policy: before-hook-creation
+spec:
+ automountServiceAccountToken: false
</code_context>
<issue_to_address>
**Concurrent tests delete each other's Pod**
When two `helm test` commands run concurrently for the same release, the shared Pod name and `before-hook-creation` policy make the second test delete the first test's running Pod before creating its own. The first test loses its hook resource and can fail even when Krini is healthy.
Give each test run a unique Pod name or avoid deleting a still-running test Pod before creating another.
</issue_to_address>
### Comment 9
<location path="deployment/templates/tests/test-connection.yaml" line_range="16" />
<code_context>
+ app.kubernetes.io/component: test
+ annotations:
+ helm.sh/hook: test
+ helm.sh/hook-delete-policy: before-hook-creation
+spec:
+ automountServiceAccountToken: false
</code_context>
<issue_to_address>
**Uninstall leaves the test Pod**
When a release has run `helm test` and is later uninstalled, the hook policy deletes the Pod only before a later test run, and Helm does not remove hook resources as ordinary release resources. The completed Pod remains in the namespace after uninstall and can consume quota or block workloads.
Add a hook deletion policy that removes the Pod after the test completes.
</issue_to_address>
### Comment 10
<location path="deployment/tests/install-chart.sh" line_range="37" />
<code_context>
+ --wait --timeout 300s "$@"
+}
+
+kubectl create namespace "${namespace}"
+# A placeholder provider: the login isn't tested here (see `e2e/`)
+providers="$(jq -cn --arg secret "$(openssl rand -hex 16)" '[{
</code_context>
<issue_to_address>
**Quick reruns collide with namespace deletion**
When the script is rerun quickly against the same cluster and namespace after a successful run, the next script run tries to create the same namespace while the previous run's asynchronous deletion is still in progress; `kubectl create namespace` fails because that namespace still exists in terminating state, so the rerun stops before installing the chart.
Wait for namespace deletion to complete before returning, or make the script safely reuse or uniquely name its namespace.
Also at `deployment/tests/install-chart.sh:66`.
</issue_to_address>
### Comment 11
<location path="docs/operator-guide/helm-chart.md" line_range="105-117" />
<code_context>
+All values with their defaults and comments are in
+[`deployment/values.yaml`](https://github.com/elixir-cloud-aai/krini/blob/dev/deployment/values.yaml).
+
+### Configuration
+
+The chart passes Krini's settings (see [Configuration](configuration.md))
+to its container as environment variables. Empty values aren't passed, so
+that Krini's defaults apply. Changing a value restarts the pods on `helm
+upgrade`.
+
+| Value | Variable | Default |
+| --- | --- | --- |
+| `hostName` | — | none; the public host name of the Ingress, HTTPRoute or Route, e.g. `krini.example.org` |
+| `config.cloudRegistryUrl` | `CLOUD_REGISTRY_URL` | none; required |
+| `config.appOrigin` | `APP_ORIGIN` | `https://<hostName>` |
+| `config.oidcRedirectUri` | `OIDC_REDIRECT_URI` | not set: Krini uses `<APP_ORIGIN>/auth/api/callback` |
+| `config.computeAccessRequestUrl` | `COMPUTE_ACCESS_REQUEST_URL` | not set |
+| `config.privacy.controller` | `PRIVACY_CONTROLLER` | not set |
</code_context>
<issue_to_address>
**Update configuration documentation**
The chart page documents the chart's settings, but configuration.md still documents the prior LS Login and OIDC_CLIENT_* variables rather than the provider-agnostic runtime configuration. The PR defers that rewrite to #77.
</issue_to_address>
### Comment 12
<location path="docs/operator-guide/helm-chart.md" line_range="20-23" />
<code_context>
+- One way to reach Krini from outside the cluster: an ingress controller, a
+ Gateway of the [Gateway API](https://gateway-api.sigs.k8s.io/), or
+ OpenShift's router.
+- An OpenID Connect client at each login provider, with the redirect URI
+ `https://<host name>/auth/api/callback`, and a Cloud Registry with the TES
+ and WES services; see [Service configuration](deployment.md#service-configuration)
+ for what the services need.
+
+## Installation
</code_context>
<issue_to_address>
**Complete service prerequisites**
The prerequisites link to service configuration, which documents WES/TES allowlisting and CORS, but not registry and gateway client acceptance or verified registry entries. The docs also don't specify the provider scope that releases groups.
</issue_to_address>
### Comment 13
<location path="README.md" line_range="55-69" />
<code_context>
--env-file ~/krini/settings.env docker.io/elixircloud/krini:<version>
```
+On Kubernetes or OpenShift, install the Helm chart in
+[`deployment/`](deployment/) instead, with the login providers in a Secret
+of your own and the settings in a values file (see [Helm
+chart][docs-helm-chart] for all steps and values), e.g. from a checkout of
+the release's tag:
+
+```bash
+kubectl create secret generic krini-login-providers -n <namespace> \
+ --from-file=login-providers=login-providers.json
+helm install krini deployment -n <namespace> \
+ --set hostName=krini.example.org \
+ --set config.cloudRegistryUrl=https://registry.example.org \
+ --set loginProviders.existingSecret=krini-login-providers \
+ --set krini.tag=<version>
+```
+
+On OpenShift, add `--set krini.ingress.enabled=false`, so that the chart
</code_context>
<issue_to_address>
**Make README setup self-contained**
The quick start gives a Secret creation command and Helm invocation, but depends on the linked operator guide for the login-provider JSON format and the full setup steps, so the README alone is insufficient.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 13 findings to address first, and a mistaken chart template or default could expose Krini through an Ingress or OpenShift Route, or weaken the pod's isolation; an unintended exposure could reveal data or access that uninstalling or reverting the chart cannot take back. The chart resources themselves can be removed, but any exposure that occurred before removal outlives the revert.
Blocking findings: deployment/templates/networkpolicy.yaml:13, deployment/templates/networkpolicy.yaml:35, deployment/templates/deployment.yaml:10, deployment/templates/_helpers.tpl:116, deployment/templates/_helpers.tpl:117, and 8 more
- Reject NetworkPolicy peers without selectors, and drop the label-based exception for the helm test pod (labels can be forged). - APP_ORIGIN must be an https origin, the privacy URLs https URLs, and /tmp's limit positive. - Document that several replicas need sticky sessions (refresh guard is per pod), the service prerequisites, the test pod after uninstall, and a provider example in the README. - Wait for the namespace deletion in the install script. Co-Authored-By: Claude Opus 5.5 <[email protected]>
elixir-cloud-aai#92 is squash-merged into dev. Conflicts in its files are resolved to dev's version, with this branch's own changes re-applied on top, so the diff against dev holds only the changes of elixir-cloud-aai#94. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Set date-released to 2026-11-19 and reorder the CITATION.cff authors by lines added on dev (without lock files, public/ and src/components/ui/, as in #74). Add everything merged since the first draft to the release notes: TES tasks with the user's token (#90), the WES run details (#100), the minimal dashboard (#108), the Helm chart (#92, #95), the image end-to-end tests (#99), the deployment docs (#101), the Next.js update (#102) and the fixes #109 and #110. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Adds a generic Helm chart for Krini in
deployment/and documents how to deploy with it.foca-common, without depending on it): Deployment, Service, and an Ingress, a Gateway API HTTPRoute or an OpenShift Route, plus an optional NetworkPolicy and a PodDisruptionBudget (with more than one replica), and ahelm testpod.hostName(orconfig.appOrigin),config.cloudRegistryUrlandloginProviders.existingSecret.LOGIN_PROVIDERS, which contains the providers' client secrets, comes only from an existing Secret (loginProviders.existingSecret/secretKey). The non-secret settings are camelCase values (config.*) passed as env vars, and empty values are left out.extraEnvcan't override the variables the chart sets./tmpas anemptyDirand no service account token.security.openshift.io/v1is served),runAsUser,runAsGroup,fsGroupandseccompProfileare omitted, so the SCC assigns them. Some OpenShift clusters rejectRuntimeDefault.values.schema.jsonusesadditionalProperties: false, URL and host name patterns, and allowsglobalfor use as a subchart./privacy, which needs no login and no other services.ci.yml. Both are in thepassedgate'sneedsand inpublish'sneeds.chart/ "Chart":helm lint --strictplusdeployment/tests/test-chart.sh, 99 render tests with helm, yq and jq, covering objects and failing values.chart-install/ "Chart install": builds the image, installs the chart on kind, runshelm test, checks for a non-root UID, and upgrades to 2 replicas with a PodDisruptionBudget (deployment/tests/install-chart.sh).deployment/README.md..dockerignorenow excludesdeployment/.Closes #52
Required checks
No ruleset change is needed. The only required check stays
CI passed, which now also needschartandchart-install.Not in this PR
configuration.mdstill describes the settings from before the provider-agnostic login (LS_LOGIN_URL,OIDC_CLIENT_*). Its rewrite is docs: deploy a released version #77. The chart page documentsLOGIN_PROVIDERSand its fields for now.Verification
helm lint deployment --strict -f deployment/ci/test-values.yaml: passed with Helm 3.22.1; the only message is INFO "icon is recommended".deployment/tests/test-chart.sh: 99 tests, 0 failures.deployment/tests/install-chart.sh krini:chart-cion a local kind cluster (kind 0.33.0) with an image built from the branch:helm testpassed (/privacy: 200, /: 307 /dashboard).maxUnavailable: 1.bun run lint(Biome): clean.npx vitest run: 237 passed.mkdocs build --strict: clean.actionlintandshellcheck: clean.tplin a scratch copy of the chart.globalis allowed in the schema, the docs warn about the Ingress on OpenShift, and port literals are replaced by a helper.APP_ORIGINmust be an https origin and the privacy URLs must be https. A zero/tmplimit is rejected. The service prerequisites are documented, along with the README provider example, the test pod left after uninstall, and the namespace wait in the install script.CI passed,Chart,Chart installandSourcery review; 2 were skipped as intended (Push imageandPublish imageon PRs). On the first push, the external "Vercel – krini" check of theelixir-cloud-aaiVercel project failed, as it also did on build: use Cloud Components 2.0.0-alpha.51 #90; it is not required and passed on the later push.Declined review findings
krini.ingress.enabled=false. Changing the default would diverge from the org's other charts.chart-install. It's a plaindocker buildfor now, which is fine at the current job time.icon. It's optional; lint reports it only as INFO.src/app/auth/api/refresh/route.ts, which is app code and out of scope here. The chart defaults to 1 replica, and the docs recommend sticky sessions for more. A follow-up issue is suggested.kubectl rollout restartfor moving tags.helm testruns (Sourcery). This is the standard hook pattern.Open questions
release.ymlshould package the chart and attach it to the GitHub release, as cloud-registry does. That would setversionandappVersionfrom the tag, sokrini.tagwould no longer be needed. Until then, operators install from a checkout of the release tag, andChart.yamlkeeps the placeholders0.0.0/dev.🤖 Generated with Claude Code
Summary by Sourcery
Provide a secure, configurable Helm-based deployment path for Krini and integrate its validation, installation checks, and operator documentation into CI.
New Features:
Enhancements:
CI:
Documentation:
Tests:
Chores: