feat: create GitKB OIDC sync client#1
Conversation
|
Warning Review limit reached
More reviews will be available in 22 minutes and 12 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds GitKB OIDC and Istio JWT support: CRD schema/status, render-time auth state and namespace labeling, Zitadel and Istio resource templates with deletion ordering, expanded readiness/status emission, updated tests, workflows, Makefile, README, and upbound metadata. ChangesGitKB Istio JWT and OIDC Authentication
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
Published Crossplane PackageThe following Crossplane package was published as part of this PR: Package: ghcr.io/hops-ops/gitkb-stack:pr-1-fcd0156a586dc83c35e32714e1eb1916240797d4 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@functions/render/200-helm-release-gitkb.yaml.gotmpl`:
- Around line 17-19: The Istio waypoint labels set when
$state.auth.istioJwt.rendered are currently merged into $chartDefaults via
mergeOverwrite and can be clobbered by user-supplied
$state.values.service.labels or by overrideAllValues; update the template so
Istio labels are applied after any user merge (i.e., ensure the final labels on
service are produced by merging user labels first and then merging/enforcing the
Istio labels into $chartDefaults or the final service.labels) and also ensure
the overrideAllValues path still injects/enforces the istio.io/use-waypoint and
istio.io/ingress-use-waypoint labels; reference $chartDefaults, mergeOverwrite,
$state.values.service.labels, overrideAllValues and
$state.auth.istioJwt.rendered when making the change.
- Around line 17-19: The Istio waypoint labels from
$state.auth.istioJwt.serviceLabels are currently merged into $chartDefaults but
can be clobbered by later mergeOverwrite with $state.values or bypassed when
$state.overrideAllValues is true; update
functions/render/200-helm-release-gitkb.yaml.gotmpl to ensure those Istio label
keys are re-applied after user merges (i.e., perform a final merge that overlays
$state.auth.istioJwt.serviceLabels onto the merged result) and also re-apply
them in the branch where $state.overrideAllValues is set, so the
istio.io/use-waypoint and istio.io/ingress-use-waypoint keys from
$state.auth.istioJwt.serviceLabels cannot be accidentally removed by
user-provided service.labels or by overrideAllValues.
In `@functions/render/450-auth-istio-jwt.yaml.gotmpl`:
- Around line 106-112: The template renders requestPrincipals directly from
auth.requestPrincipals which can be an explicitly empty list and produce an
empty matcher; update the logic in
functions/render/450-auth-istio-jwt.yaml.gotmpl to detect an empty or unset
auth.requestPrincipals and fall back to rendering a single entry "*" (the same
default used in functions/render/000-state-init.yaml.gotmpl) instead of emitting
an empty list—i.e., change the section around requestPrincipals to check for
emptiness and render ["*"] when auth.requestPrincipals is nil or has length
zero, otherwise range over auth.requestPrincipals as before.
In `@upbound.yaml`:
- Around line 44-47: Remove the stray sentence fragment "This" that ends the
first sentence so the paragraph reads smoothly; update the text mentioning
`git-kb serve` and the following sentence about `auth.oidcClient` and
`auth.istioJwt` (Zitadel MachineUser / Istio project audience) by deleting the
orphaned "This" to join the sentences correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9e0e565f-0dcc-49e1-a5dc-49e151eb32c4
📒 Files selected for processing (15)
.github/workflows/on-pr.yaml.github/workflows/on-push-main.yamlMakefileREADME.mdapis/gitkbs/definition.yamlexamples/gitkbs/with-istio-jwt.yamlfunctions/render/000-state-init.yaml.gotmplfunctions/render/010-state-status.yaml.gotmplfunctions/render/100-namespace.yaml.gotmplfunctions/render/200-helm-release-gitkb.yaml.gotmplfunctions/render/400-auth-zitadel-client.yaml.gotmplfunctions/render/450-auth-istio-jwt.yaml.gotmplfunctions/render/999-status.yaml.gotmpltests/test-render/main.kupbound.yaml
There was a problem hiding this comment.
♻️ Duplicate comments (1)
upbound.yaml (1)
44-45:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFix sentence fragment.
The stray "This" at the end of line 44 creates a sentence fragment. This issue was previously flagged and remains unresolved.
📝 Proposed fix
The HTTPRoute strips that prefix before forwarding traffic to - `git-kb serve`, so many GitKB repos can share one Gateway domain. This - For authenticated sync traffic, enable `auth.oidcClient` and + `git-kb serve`, so many GitKB repos can share one Gateway domain. + For authenticated sync traffic, enable `auth.oidcClient` and🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@upbound.yaml` around lines 44 - 45, The sentence fragment is caused by the stray word "This" at the end of the line in upbound.yaml; remove the stray "This" (or complete the sentence by moving it to or merging with the following line) so the paragraph reads coherently — specifically edit the lines containing "`git-kb serve`, so many GitKB repos can share one Gateway domain. This" and "For authenticated sync traffic, enable `auth.oidcClient` and" to either drop "This" or join it into a complete sentence that links to the `auth.oidcClient` instruction.
🧹 Nitpick comments (1)
upbound.yaml (1)
45-48: ⚡ Quick winClarify the run-on sentence structure.
The sentence spanning lines 45-48 is grammatically awkward with mixed subjects ("GitKB gets" and "Istio validates"). Consider restructuring for clarity.
📝 Suggested rewording
For authenticated sync traffic, enable `auth.oidcClient` and - `auth.istioJwt` so GitKB gets its own Zitadel device-flow client for human - login, MachineUser client for automation, and Istio validates the shared - project audience. + `auth.istioJwt` so GitKB provisions its own Zitadel device-flow client for + human login and MachineUser client for automation, while Istio validates + the shared project audience.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@upbound.yaml` around lines 45 - 48, The sentence describing authenticated sync traffic mixes subjects and reads as a run-on; rewrite it to separate the actions and clarify who does what. Update the text to explicitly state that enabling auth.oidcClient creates Zitadel clients for GitKB (a device-flow client for human login and a MachineUser client for automation) and that enabling auth.istioJwt causes Istio to validate the shared project audience, e.g., two short sentences or a semicolon-separated pair referencing auth.oidcClient, auth.istioJwt, GitKB, Zitadel/MachineUser, and Istio so each responsibility is clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@upbound.yaml`:
- Around line 44-45: The sentence fragment is caused by the stray word "This" at
the end of the line in upbound.yaml; remove the stray "This" (or complete the
sentence by moving it to or merging with the following line) so the paragraph
reads coherently — specifically edit the lines containing "`git-kb serve`, so
many GitKB repos can share one Gateway domain. This" and "For authenticated sync
traffic, enable `auth.oidcClient` and" to either drop "This" or join it into a
complete sentence that links to the `auth.oidcClient` instruction.
---
Nitpick comments:
In `@upbound.yaml`:
- Around line 45-48: The sentence describing authenticated sync traffic mixes
subjects and reads as a run-on; rewrite it to separate the actions and clarify
who does what. Update the text to explicitly state that enabling auth.oidcClient
creates Zitadel clients for GitKB (a device-flow client for human login and a
MachineUser client for automation) and that enabling auth.istioJwt causes Istio
to validate the shared project audience, e.g., two short sentences or a
semicolon-separated pair referencing auth.oidcClient, auth.istioJwt, GitKB,
Zitadel/MachineUser, and Istio so each responsibility is clear.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9363cb6d-19d7-4111-9387-aefcabb0f41b
📒 Files selected for processing (9)
README.mdapis/gitkbs/definition.yamlexamples/gitkbs/with-istio-jwt.yamlfunctions/render/000-state-init.yaml.gotmplfunctions/render/010-state-status.yaml.gotmplfunctions/render/400-auth-zitadel-client.yaml.gotmplfunctions/render/999-status.yaml.gotmpltests/test-render/main.kupbound.yaml
🚧 Files skipped from review as they are similar to previous changes (6)
- functions/render/999-status.yaml.gotmpl
- examples/gitkbs/with-istio-jwt.yaml
- README.md
- apis/gitkbs/definition.yaml
- functions/render/010-state-status.yaml.gotmpl
- functions/render/000-state-init.yaml.gotmpl
Summary
spec.auth.oidcClientso the GitKB stack creates its own Zitadel Project, Role, MachineUser, and GrantRequestAuthenticationaudiences for sync trafficstatus.auth.oidcClientwith client ID, project audience, credential Secret reference, and readiness fieldsauth.istioJwtas the mesh enforcement layer and document the GitKB CLI client credentials configurationValidation
make rendermake validatemake testgit diff --checkhops config install --path /Users/patrickleet/dev/hops-ops/hops/xrs/stacks/k8s/gitkb --context colimakubectl --context colima apply -f local/gitkb.yamlLocal Control Plane Evidence
registry.crossplane-system.svc.cluster.local:5000/hops-ops/gitkb-stack:dev-63bfca26493cGitKB/default/gitkbisReady=Truestatus.auth.oidcClient.clientIdisgitkb-syncstatus.auth.oidcClient.projectIdis376749978338467934Project,MachineUser, andGrantareReady=TrueRequestAuthenticationuses issuerhttps://auth.ops.com.aiand audience376749978338467934attribute.client_id,attribute.client_secretNotes
Summary by CodeRabbit
New Features
Defaults
Documentation
Tests
Chores