Skip to content

Add helm deployment & fix generator#347

Merged
mjudeikis merged 2 commits into
kbind-dev:mainfrom
mjudeikis:mjudeikis/deploy.helm
Oct 24, 2025
Merged

Add helm deployment & fix generator#347
mjudeikis merged 2 commits into
kbind-dev:mainfrom
mjudeikis:mjudeikis/deploy.helm

Conversation

@mjudeikis

@mjudeikis mjudeikis commented Oct 23, 2025

Copy link
Copy Markdown
Contributor

Summary

  • Add helm repository for backend
  • Add documentation how to deploy it
  • Fixup generator to generate right rbac rules
  • Change terminology on UI/web to be "services"

What Type of PR Is This?

/kind feature

Related Issue(s)

Fixes #

Release Notes

Add initial helm deployment 

Summary by CodeRabbit

  • New Features

    • Local Helm build/push/test tooling, improved chart naming/labels/service-account handling, and new Helm packaging flow
    • CLI now shows verbose step-by-step progress for bind operations
    • Added e2e test target for external contrib components
    • UI terminology: "Modules" renamed to "Services"
  • Bug Fixes

    • Authorization callback now uses 127.0.0.1 for local redirects
  • Documentation

    • Detailed Helm installation guide with examples
  • Chores

    • Removed example Let's Encrypt/Dex/OIDC secret templates; updated ignore patterns and Helm ignore rules

@mjudeikis mjudeikis requested a review from a team as a code owner October 23, 2025 16:39
@mjudeikis mjudeikis changed the title Add helm deployment & fixup generator Add helm deployment & fix generator Oct 23, 2025
@coderabbitai

coderabbitai Bot commented Oct 23, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Migrates kubebuilder RBAC markers from kubebind.k8s.io to kube-bind.io, adds RBAC annotation file, introduces Helm chart helpers and packaging targets, updates Makefile (image tagging, helm targets, e2e), adjusts local auth redirect host to 127.0.0.1, enhances CLI bind logging, removes legacy Dex/Let’s Encrypt templates, updates .gitignore, and adds Helm install docs and codegen outputs.

Changes

Cohort / File(s) Summary
RBAC API Group Migration
backend/controllers/clusterbinding/clusterbinding_controller.go, backend/controllers/serviceexport/serviceexport_controller.go, backend/controllers/serviceexportrequest/serviceexportrequest_controller.go, backend/controllers/servicenamespace/servicenamespace_controller.go
Replaced kubebuilder RBAC annotations group kubebind.k8s.io with kube-bind.io and adjusted annotated verbs/subresources where applicable.
RBAC Annotations File
backend/controllers/rbac.go
New file containing kubebuilder RBAC markers for core and export-related permissions (annotation-only, no runtime code).
Makefile — Build & Helm Targets
Makefile
Added REV and IMAGE_REPO; removed KIND_CLUSTER/KO_DOCKER_REPO usage; updated image-local to emit fully qualified images; added test-e2e-contrib-kcp, helm-build-local, helm-clean, helm-push-local, helm-test; chart packaging/versioning logic added.
Helm Chart Helpers & Ignore
deploy/charts/backend/.helmignore, deploy/charts/backend/templates/_helpers.tpl
Added .helmignore and Helm helper templates for consistent naming, labels, chart id, selector labels, and serviceAccountName resolution.
Callback Host & UI Text
backend/http/handler.go, backend/template/resources.gohtml
handleAuthorize now builds local redirect using 127.0.0.1 when port provided and no RedirectURL; UI text/IDs rebranded from "Modules" to "Services".
CLI Logging / Output
cli/pkg/kubectl/bind-apiservice/plugin/bind.go, cli/pkg/kubectl/bind/plugin/bind.go
Added verbose stepwise progress/error logging in bind-apiservice flow; inserted an extra newline before the "Executing: kubectl bind ..." error log in bind plugin.
Codegen / Helm CRDs & RBAC
hack/update-codegen.sh
Added controller-gen invocations to emit CRDs to deploy/charts/backend/crds and generate RBAC manifests into deploy/charts/backend/templates for Helm packaging.
Docs — Helm Install
docs/content/setup/helm.md
New comprehensive Helm/OCI chart installation guide with examples and production/dev notes.
Gitignore / Manifests Cleanup
.gitignore, deploy/manifests/example-backend/letsencrypt/...
Removed -dex/ ignore and added *.prod to root .gitignore; removed *-secret.yaml and cluster-issuer.yaml ignores under letsencrypt; deleted legacy templates cluster-issuer.yaml.tmpl, dex-config-secret.yaml.tmpl, oidc-secret.yaml.tmpl.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • xrstf
  • s-urbaniak

Poem

RBAC moved and charts aligned,
Build and Helm rules redefined.
Callbacks point to localhost’s IP,
CLI logs now trace each step by step,
Old Dex templates pruned — the repo trimmed.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add helm deployment & fix generator" is partially related to the changeset. It accurately reflects two significant and real aspects of the pull request: the addition of Helm deployment infrastructure and the fixes to the code generator for RBAC rules. However, the title does not capture other substantial changes present in the changeset, such as the terminology update from "Modules" to "Services" in the UI component or the API group changes across multiple controllers. The title is specific and clear enough for teammates to understand the primary infrastructure-focused changes, though it represents only a portion of the overall scope.
Description Check ✅ Passed The pull request description follows the required template structure and includes all necessary sections with substantive content. The Summary section provides four clear bullet points covering the main changes: Helm repository addition, deployment documentation, generator fix for RBAC rules, and UI terminology updates. The PR type is correctly specified as /kind feature, and release notes are provided with "Add initial helm deployment." The Related Issue(s) section shows the template placeholder without a specific issue number, which is acceptable as it does not detract from the overall completeness of the description.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1d334d and 21d91e9.

⛔ Files ignored due to path filters (20)
  • deploy/charts/backend/Chart.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_apiservicebindings.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_apiserviceexportrequests.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_apiserviceexports.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_apiserviceexporttemplates.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_apiservicenamespaces.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_boundschemas.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_clusterbindings.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/crds/kube-bind.io_collections.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/examples/values-local-development.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/clusterrolebinding.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/deployment.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/hpa.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/role.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/service.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/serviceaccount.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/tests/test-connection.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/values.yaml is excluded by !**/*.yaml
  • deploy/manifests/example-backend/insecure/example-backend.yaml is excluded by !**/*.yaml
  • deploy/manifests/example-backend/letsencrypt/example-backend.yaml is excluded by !**/*.yaml
📒 Files selected for processing (19)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • backend/controllers/clusterbinding/clusterbinding_controller.go (1 hunks)
  • backend/controllers/rbac.go (1 hunks)
  • backend/controllers/serviceexport/serviceexport_controller.go (1 hunks)
  • backend/controllers/serviceexportrequest/serviceexportrequest_controller.go (1 hunks)
  • backend/controllers/servicenamespace/servicenamespace_controller.go (1 hunks)
  • backend/http/handler.go (1 hunks)
  • backend/template/resources.gohtml (5 hunks)
  • cli/pkg/kubectl/bind-apiservice/plugin/bind.go (1 hunks)
  • cli/pkg/kubectl/bind/plugin/bind.go (1 hunks)
  • deploy/charts/backend/.helmignore (1 hunks)
  • deploy/charts/backend/templates/_helpers.tpl (1 hunks)
  • deploy/manifests/example-backend/letsencrypt/.gitignore (0 hunks)
  • deploy/manifests/example-backend/letsencrypt/cluster-issuer.yaml.tmpl (0 hunks)
  • deploy/manifests/example-backend/letsencrypt/dex-config-secret.yaml.tmpl (0 hunks)
  • deploy/manifests/example-backend/letsencrypt/oidc-secret.yaml.tmpl (0 hunks)
  • docs/content/setup/helm.md (1 hunks)
  • hack/update-codegen.sh (1 hunks)
💤 Files with no reviewable changes (4)
  • deploy/manifests/example-backend/letsencrypt/.gitignore
  • deploy/manifests/example-backend/letsencrypt/cluster-issuer.yaml.tmpl
  • deploy/manifests/example-backend/letsencrypt/dex-config-secret.yaml.tmpl
  • deploy/manifests/example-backend/letsencrypt/oidc-secret.yaml.tmpl
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-22T13:32:29.499Z
Learnt from: mjudeikis
PR: kube-bind/kube-bind#304
File: pkg/konnector/controllers/cluster/claimedresources/claimedresources_controller.go:255-263
Timestamp: 2025-09-22T13:32:29.499Z
Learning: In kube-bind's claimedresources controller (pkg/konnector/controllers/cluster/claimedresources/claimedresources_controller.go), the controller does not run if apiServiceExport is not set. This means nil-checks for c.apiServiceExport are unnecessary since the controller lifecycle ensures it's always non-nil when active.

Applied to files:

  • backend/controllers/serviceexportrequest/serviceexportrequest_controller.go
  • backend/controllers/serviceexport/serviceexport_controller.go
📚 Learning: 2025-09-19T05:56:35.969Z
Learnt from: mjudeikis
PR: kube-bind/kube-bind#304
File: backend/controllers/servicenamespace/servicenamespace_reconcile.go:81-98
Timestamp: 2025-09-19T05:56:35.969Z
Learning: In kube-bind, RBAC permissions for PermissionClaims use "*" verbs intentionally. This is a design decision based on: 1) permissions are scoped to consumer-owned provider namespaces, limiting blast radius, 2) bidirectional resource flow requires broad permissions for operations like initial resource creation from consumer side, 3) kube-bind's architecture prioritizes operational simplicity over granular RBAC within the namespace security boundary.

Applied to files:

  • backend/controllers/servicenamespace/servicenamespace_controller.go
🧬 Code graph analysis (2)
cli/pkg/kubectl/bind/plugin/bind.go (1)
cli/pkg/kubectl/base/options.go (1)
  • Options (26-40)
cli/pkg/kubectl/bind-apiservice/plugin/bind.go (1)
cli/pkg/kubectl/base/options.go (1)
  • Options (26-40)
🪛 LanguageTool
docs/content/setup/helm.md

[grammar] ~13-~13: Use a hyphen to join words.
Context: ...nt version of kube-bind uses application level redirect (HTTP 302) to CLI. Your i...

(QB_NEW_EN_HYPHEN)

🪛 markdownlint-cli2 (0.18.1)
docs/content/setup/helm.md

6-6: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


11-11: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


15-15: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


24-24: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


59-59: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


66-66: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


69-69: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


87-87: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


132-132: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


136-136: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


234-234: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)

🔇 Additional comments (18)
backend/http/handler.go (1)

207-209: LGTM: Using 127.0.0.1 improves OAuth callback reliability.

The change from localhost to 127.0.0.1 is beneficial as it bypasses DNS resolution and ensures consistent behavior across different environments where localhost resolution might vary.

.gitignore (1)

18-18: LGTM: Standard pattern to exclude production files.

The addition of *.prod follows common practices for excluding environment-specific artifacts from version control.

backend/controllers/serviceexportrequest/serviceexportrequest_controller.go (1)

180-185: LGTM: RBAC group migration is consistent.

The API group migration from kubebind.k8s.io to kube-bind.io is correctly applied across all related resources and aligns with the broader changes throughout this PR.

backend/controllers/servicenamespace/servicenamespace_controller.go (1)

209-213: LGTM: RBAC group migration is correctly applied.

The API group update from kubebind.k8s.io to kube-bind.io is consistent with the project-wide migration. Core Kubernetes resources (namespaces, rolebindings) correctly maintain their original groups.

cli/pkg/kubectl/bind/plugin/bind.go (1)

295-298: LGTM: Improves CLI output formatting.

The additional newline enhances output readability by providing better visual separation before the command execution log.

backend/template/resources.gohtml (1)

13-13: LGTM: Comprehensive and consistent terminology update.

The rebranding from "modules" to "services" is consistently applied across CSS classes, variable names, element IDs, and user-facing text throughout the template.

Also applies to: 39-57, 138-140, 143-143, 174-177, 220-220

deploy/charts/backend/.helmignore (1)

1-23: LGTM: Standard Helm ignore patterns.

The file includes appropriate patterns to exclude common development artifacts, VCS directories, backup files, and IDE-specific folders from Helm packages.

backend/controllers/clusterbinding/clusterbinding_controller.go (1)

150-155: LGTM: RBAC migration with expanded resource coverage.

The API group migration from kubebind.k8s.io to kube-bind.io is correctly applied. The addition of collections and apiserviceexporttemplates appropriately expands the controller's RBAC permissions to support the new resources introduced in this PR.

cli/pkg/kubectl/bind-apiservice/plugin/bind.go (1)

146-214: Excellent UX improvement with step-by-step progress logging.

The verbose logging provides clear visibility into the binding process, which will significantly improve the user experience. Each step is well-documented with start, success, and error messages.

One minor consideration: emoji characters (🔧, 📋, ✅, ❌) may not render correctly in all terminal environments (e.g., older Windows terminals, some CI/CD systems). Consider whether a fallback to plain text indicators would be appropriate for maximum compatibility.

hack/update-codegen.sh (2)

38-44: CRD generation for Helm chart looks correct.

The duplication of CRD generation to the Helm chart directory enables Helm-based deployment and CRD lifecycle management.


46-50: RBAC generation added for Helm chart.

This generates RBAC manifests from backend controller annotations with roleName=kube-bind-role. Note that the CRD generation blocks use roleName=manager-role while this uses kube-bind-role. Verify that this difference is intentional and reflects the correct role separation.

backend/controllers/rbac.go (2)

19-24: Core RBAC permissions are appropriate.

The explicit verb list for core resources follows the principle of least privilege and provides necessary permissions for backend controller operations.


26-29: No changes required. Wildcard permissions are intentionally scoped to namespace-based isolation.

The wildcard RBAC permissions on configmaps and secrets serve a specific purpose: enabling the backend controller to delegate permissions to exported resources. This design is intentional and scoped through kube-bind's namespace isolation mechanism. Per architectural documentation, these permissions are constrained to consumer-owned provider namespaces through APIServiceNamespace controllers and multi-namespace informers that limit access to designated provider and service namespaces. The bidirectional resource flow architecture requires this broad delegation capability to function within the established security boundary.

backend/controllers/serviceexport/serviceexport_controller.go (1)

85-89: API group migration looks correct.

The RBAC markers have been properly updated from kubebind.k8s.io to kube-bind.io, consistent with the PR's API group standardization objective.

docs/content/setup/helm.md (1)

1-242: Comprehensive and well-structured Helm installation documentation.

The documentation provides clear, step-by-step guidance for installing kube-bind with Helm, including all necessary prerequisites and configuration options. The use of placeholder values (### REPLACE ME ###) appropriately guides users to customize for their environment.

Note: Static analysis flagged markdown heading style preferences (MD003), but these are stylistic choices and not functional issues.

Makefile (2)

299-302: Kind cluster configuration variables are well-designed.

The defaults are sensible for both local development and CI environments. Using conditional assignment (?=) allows users to override values via environment variables.


303-311: Kind E2E test target implementation is correct.

The target properly depends on build and image-local to ensure prerequisites are met, configures environment variables for test execution, and provides clear user feedback. The test configuration supports both cleanup and log collection.

deploy/charts/backend/templates/_helpers.tpl (1)

1-62: Standard Helm chart helper templates are correctly implemented.

All helper functions follow Helm best practices:

  • Name truncation complies with Kubernetes DNS naming requirements (63 characters)
  • Fullname logic intelligently handles release name containment
  • Label templates include all recommended Kubernetes labels
  • Service account resolution correctly respects the create flag

Comment thread docs/content/setup/helm.md Outdated
Comment thread Makefile Outdated
@mjudeikis mjudeikis force-pushed the mjudeikis/deploy.helm branch from daec1d6 to 49f2552 Compare October 24, 2025 11:53
Comment thread docs/content/setup/helm.md
@mjudeikis mjudeikis force-pushed the mjudeikis/deploy.helm branch from 49f2552 to ce335ba Compare October 24, 2025 11:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
backend/controllers/rbac.go (1)

26-29: Remove redundant wildcard RBAC permissions for ConfigMaps and Secrets (lines 28-29).

The wildcard verbs on lines 28-29 are redundant. Line 34 already grants unrestricted access via groups=*,resources=*,verbs=*, which encompasses ConfigMaps, Secrets, and all other resources. The code comment on line 33 acknowledges this redundancy. Delete lines 28-29 to improve clarity, as the broader wildcard on line 34 already provides the necessary permissions for the backend to create ClusterRoles with arbitrary permissions for bound resources.

Makefile (3)

410-433: Redundant backup file creation in helm-build-local.

Lines 422–425 create both a .bak backup (via cp) and .tmp backup (via sed -i.tmp), with the latter immediately removed. This dual-backup pattern is redundant and adds complexity. The .tmp files serve no purpose.

Simplify by using only the .bak backup pattern without sed's backup extension:

  cp "$${chart_dir}Chart.yaml" "$${chart_dir}Chart.yaml.bak"; \
- sed -i.tmp "s/^version:.*/version: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \
- sed -i.tmp "s/^appVersion:.*/appVersion: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \
- rm -f "$${chart_dir}Chart.yaml.tmp"; \
+ sed -i "s/^version:.*/version: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \
+ sed -i "s/^appVersion:.*/appVersion: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \

Note: Verify that -i (without backup extension) works on all target platforms. If compatibility issues arise, use -i '' for macOS or -i for GNU sed explicitly.


435-437: Add a top-level clean target for Makefile conventions.

The Makefile lacks a general .PHONY: clean target, which is conventionally expected to remove build artifacts. While helm-clean removes Helm charts, a top-level clean target that invokes helm-clean and removes other artifacts (e.g., ./bin/) would improve consistency.

Consider adding:

+ .PHONY: clean
+ clean: helm-clean ## Clean build artifacts
+ 	rm -rf $(GOBIN_DIR)
+
  .PHONY: helm-clean
  helm-clean: ## Clean up built helm charts
  	rm -f ./bin/*.tgz

460-471: Helm-test target could be more explicit about namespace and output.

The helm install command on line 468 lacks an explicit --namespace flag, which will install into the default namespace. Additionally, the --debug flag produces verbose output that may be overwhelming for dry-run testing. Consider whether these are intentional for testing purposes.

If test isolation is desired, add --namespace helm-test-temp or similar; otherwise, this is acceptable for local testing. You may also consider whether --debug is necessary for dry-run validation or if it can be removed for cleaner output.

docs/content/setup/helm.md (1)

6-300: Markdown heading style inconsistency with project linter.

The file uses ATX-style headings (# ## ###) consistently throughout, but the project's markdownlint configuration expects setext style (underlines with === and ---). While ATX style is readable and widely used, updating to setext style would align with project guidelines.

If the project enforces strict markdown style, convert ATX headings to setext style. For example:

- # Installation with Helm
+ Installation with Helm
+ =======================
  
- ## Quick Start
+ Quick Start
+ -----------

However, if strict markdown style enforcement is not a project priority, this can be deferred or the linter configuration can be adjusted to accept both styles.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21d91e9 and ce335ba.

⛔ Files ignored due to path filters (2)
  • .github/workflows/image.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/role.yaml is excluded by !**/*.yaml
📒 Files selected for processing (3)
  • Makefile (4 hunks)
  • backend/controllers/rbac.go (1 hunks)
  • docs/content/setup/helm.md (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-19T05:56:35.969Z
Learnt from: mjudeikis
PR: kube-bind/kube-bind#304
File: backend/controllers/servicenamespace/servicenamespace_reconcile.go:81-98
Timestamp: 2025-09-19T05:56:35.969Z
Learning: In kube-bind, RBAC permissions for PermissionClaims use "*" verbs intentionally. This is a design decision based on: 1) permissions are scoped to consumer-owned provider namespaces, limiting blast radius, 2) bidirectional resource flow requires broad permissions for operations like initial resource creation from consumer side, 3) kube-bind's architecture prioritizes operational simplicity over granular RBAC within the namespace security boundary.

Applied to files:

  • backend/controllers/rbac.go
🪛 checkmake (0.2.2)
Makefile

[warning] 460-460: Missing required phony target "clean"

(minphony)

🪛 markdownlint-cli2 (0.18.1)
docs/content/setup/helm.md

6-6: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


11-11: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


15-15: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


24-24: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


73-73: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


80-80: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


88-88: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


106-106: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


151-151: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


155-155: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


253-253: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


265-265: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


269-269: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


274-274: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)


289-289: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: go-test-e2e
  • GitHub Check: lint
🔇 Additional comments (8)
backend/controllers/rbac.go (3)

1-18: Standard structure established.

The copyright header and package declaration are correct and follow standard conventions.


19-24: Core permissions are appropriately scoped.

The RBAC permissions for standard Kubernetes resources are correctly defined with explicit verbs, providing necessary access for backend controllers to manage CRDs, ServiceAccounts, Secrets, ConfigMaps, and Namespaces.


31-34: Wildcard RBAC permission is necessary but requires explicit security justification.

The code analysis confirms that the wildcard permission groups=*,resources=*,verbs=* is required: the backend controllers dynamically create ClusterRoles with rules for arbitrary API groups and resources based on APIServiceExport definitions. Without cluster-wide RBAC permissions, these operations would fail.

However, this still represents a significant security posture that warrants explicit documentation:

  • Add a reference in backend/controllers/rbac.go comments to the security model/threat analysis justifying cluster-admin equivalent access
  • Document which specific ClusterRole creation operations require this permission level (reference clusterbinding_reconcile.go:ensureRBACClusterRole and servicenamespace_reconcile.go PermissionClaims reconciliation)
  • Clarify whether this design decision has been reviewed against the principle of least privilege for Helm deployment scenarios
Makefile (2)

27-30: Image tagging variables are well-designed for build reproducibility.

The REV and IMAGE_REPO variables correctly support deterministic versioning tied to git commits and configurable image repositories, enabling both local and registry-based deployments.


379-401: Image-local target improvements enhance clarity and consistency.

The updated target now consistently uses IMAGE_REPO and REV for tagging, displays user-friendly output showing full image names, and includes a usage example in comments. This improves developer experience.

docs/content/setup/helm.md (3)

1-70: Quick Start section provides clear, actionable installation guidance.

The introduction correctly notes the HTTP 302 redirect requirement, and the step-by-step installation instructions are well-structured with helpful version discovery scripts and clear explanations. The optional seed resources are appropriately documented.


73-261: Prerequisites and setup guidance are comprehensive and well-documented.

The Kubernetes, Helm, cert-manager, and OIDC provider sections provide clear, step-by-step instructions with practical examples. The Dex configuration includes necessary details for certificate management, GitHub authentication, and client setup. Placeholder replacement guidance is explicit and helpful.


265-300: OCI chart documentation correctly reflects Makefile versioning strategy.

The documentation accurately describes the OCI chart registry path and version formats (release versions and development builds with git SHA), which align with the Makefile's REV variable and helm-build-local target. Installation examples are clear and cover all use cases (latest release, specific version, development builds).

Comment thread Makefile Outdated
Comment thread docs/content/setup/helm.md Outdated
Comment thread Makefile Outdated
@mjudeikis mjudeikis force-pushed the mjudeikis/deploy.helm branch from ce335ba to f1a3cd0 Compare October 24, 2025 12:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/content/setup/helm.md (1)

30-35: Consider adding error handling for version extraction.

The version extraction pipeline on line 31 combines multiple commands that could fail silently if the GitHub API response format changes or if network issues occur. Consider documenting fallback behavior or adding validation.

Example enhancement:

# Get latest version with error handling
VERSION=$(curl -sf https://api.github.com/repos/kube-bind/kube-bind/releases/latest | grep '"tag_name"' | cut -d'"' -f4 | sed 's/v//')
if [ -z "$VERSION" ]; then
  echo "Error: Failed to fetch latest version. Please specify VERSION manually."
  exit 1
fi
echo "Using version: $VERSION"
Makefile (1)

27-30: Consider making REV overridable for development workflows.

Based on the past discussion, developers may benefit from being able to override REV during local development to avoid updating SHA references after every commit. Consider changing line 29 to allow conditional override:

 # Image build configuration
 # REV is the short git sha of latest commit.
-REV=$(shell git rev-parse --short HEAD)
+REV ?= $(shell git rev-parse --short HEAD)
 IMAGE_REPO ?= kube-bind

This allows developers to set REV=dev in their environment while maintaining the default SHA-based behavior for CI/CD.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce335ba and f1a3cd0.

⛔ Files ignored due to path filters (2)
  • .github/workflows/image.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/role.yaml is excluded by !**/*.yaml
📒 Files selected for processing (3)
  • Makefile (4 hunks)
  • backend/controllers/rbac.go (1 hunks)
  • docs/content/setup/helm.md (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-19T05:56:35.969Z
Learnt from: mjudeikis
PR: kube-bind/kube-bind#304
File: backend/controllers/servicenamespace/servicenamespace_reconcile.go:81-98
Timestamp: 2025-09-19T05:56:35.969Z
Learning: In kube-bind, RBAC permissions for PermissionClaims use "*" verbs intentionally. This is a design decision based on: 1) permissions are scoped to consumer-owned provider namespaces, limiting blast radius, 2) bidirectional resource flow requires broad permissions for operations like initial resource creation from consumer side, 3) kube-bind's architecture prioritizes operational simplicity over granular RBAC within the namespace security boundary.

Applied to files:

  • backend/controllers/rbac.go
📚 Learning: 2025-10-24T12:12:18.455Z
Learnt from: ntnn
PR: kube-bind/kube-bind#347
File: Makefile:299-302
Timestamp: 2025-10-24T12:12:18.455Z
Learning: In Makefiles, when a target is explicitly declared with dependencies followed by a pattern rule that matches that target, the explicit declaration adds additional dependencies while the pattern rule provides the recipe. This is valid syntax and the target will execute both the added dependencies and the pattern rule's recipe.

Applied to files:

  • Makefile
🪛 checkmake (0.2.2)
Makefile

[warning] 459-459: Missing required phony target "clean"

(minphony)

🔇 Additional comments (4)
backend/controllers/rbac.go (1)

19-34: RBAC permissions are appropriately broad for kube-bind's architecture.

The wildcard permissions on line 34 (groups=*,resources=*,verbs=*) grant cluster-admin level access, which is a significant security consideration. However, this is an intentional design decision that aligns with kube-bind's architecture:

  1. Permissions are scoped to consumer-owned provider namespaces, limiting blast radius
  2. The backend needs to create ClusterRoles with permissions for dynamically bound resources
  3. Bidirectional resource flow requires broad operational permissions

The redundant specific permissions (lines 20-29) are appropriately retained for clarity and traceability, as noted in the inline comment.

Based on learnings.

Makefile (3)

378-400: Image building logic is correct and well-structured.

The image-local target properly uses the new IMAGE_REPO and REV variables, provides clear user feedback, and validates tool dependencies. The implementation is consistent across both konnector and backend image builds.


409-432: Helm chart packaging implementation is robust.

The helm-build-local target correctly:

  • Backs up Chart.yaml before modification
  • Uses sed -i.tmp for cross-platform compatibility (macOS requires a backup extension)
  • Sets semantic version format 0.0.0-<sha> suitable for development builds
  • Restores the original Chart.yaml after packaging

The cleanup of .tmp files on line 424 ensures no artifacts are left behind.


438-457: OCI registry push logic includes proper validation.

The helm-push-local target appropriately:

  • Enables OCI experimental support (line 444)
  • Validates chart names to skip invalid entries containing spaces (lines 449-452)
  • Provides clear user feedback with registry URLs

This prevents errors from malformed chart names while maintaining a robust push workflow.

Signed-off-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
 On-behalf-of: @SAP mangirdas.judeikis@sap.com
@mjudeikis mjudeikis force-pushed the mjudeikis/deploy.helm branch from f1a3cd0 to 047ba71 Compare October 24, 2025 17:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Makefile (1)

402-407: Critical: kind-load target references undefined $(KO_DOCKER_REPO) variable.

The kind-load target uses $(KO_DOCKER_REPO) on lines 405-406, but this variable is not defined. The image-local target sets it locally (line 385, 392), which does not affect the kind-load scope. This target will fail with an undefined variable error.

Update kind-load to use $(IMAGE_REPO) instead:

 .PHONY: kind-load
 kind-load:
 	@echo "Loading images into kind cluster '$(KIND_CLUSTER)'"
-	kind load docker-image $(KO_DOCKER_REPO)/konnector:$(REV) --name $(KIND_CLUSTER)
-	kind load docker-image $(KO_DOCKER_REPO)/backend:$(REV) --name $(KIND_CLUSTER)
+	kind load docker-image $(IMAGE_REPO)/konnector:$(REV) --name $(KIND_CLUSTER)
+	kind load docker-image $(IMAGE_REPO)/backend:$(REV) --name $(KIND_CLUSTER)
 	@echo "Successfully loaded images into kind cluster '$(KIND_CLUSTER)'"
🧹 Nitpick comments (4)
Makefile (3)

409-432: Helm chart packaging logic is sound, but sed command sequence could be clearer.

The helm-build-local target correctly manages Chart.yaml modifications (backup → sed modify → cleanup → restore). However, using sed -i.tmp followed by rm -f ${chart_dir}Chart.yaml.tmp is more verbose than necessary.

Consider simplifying with a clearer approach:

-			cp "$${chart_dir}Chart.yaml" "$${chart_dir}Chart.yaml.bak"; \
-			sed -i.tmp "s/^version:.*/version: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \
-			sed -i.tmp "s/^appVersion:.*/appVersion: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \
-			rm -f "$${chart_dir}Chart.yaml.tmp"; \
+			cp "$${chart_dir}Chart.yaml" "$${chart_dir}Chart.yaml.bak"; \
+			sed -i '' "s/^version:.*/version: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \
+			sed -i '' "s/^appVersion:.*/appVersion: $$CHART_VERSION/" "$${chart_dir}Chart.yaml"; \

This avoids intermediate backup files from sed operations (the -i '' pattern is portable across BSD and GNU sed).


438-457: helm-push-local target is well-designed but ensure OCI registry credentials are pre-configured.

The target correctly exports HELM_EXPERIMENTAL_OCI and handles chart discovery. However, the target assumes the user is already authenticated to the OCI registry (IMAGE_REPO). Consider adding a comment or validation to clarify this prerequisite.

 .PHONY: helm-push-local
 helm-push-local: ## Push Helm charts to IMAGE_REPO registry
 	@echo "Pushing Helm charts to registry: $(IMAGE_REPO)"
+	@echo "Note: Ensure you are authenticated to $(IMAGE_REPO) (e.g., 'helm registry login' or 'docker login')"
 	@command -v helm >/dev/null 2>&1 || { echo "helm not found. Install from: https://helm.sh/docs/intro/install/"; exit 1; }

1-16: Consider adding a general clean target to complement helm-clean.

Static analysis flagged a missing "clean" target. While helm-clean removes Helm chart artifacts, a general clean target would follow Makefile conventions and provide a single entry point for cleanup operations. This would typically remove build artifacts, cached files, and generated outputs.

Consider adding:

.PHONY: clean
clean: helm-clean ## Clean all build and generated artifacts
	rm -rf $(GOBIN_DIR)
	rm -rf bin/
	rm -rf .kcp/
	git clean -fdX
backend/controllers/rbac.go (1)

26-29: Clarify the need for duplicate wildcard permissions.

Lines 28-29 grant wildcard verbs (*) for configmaps and secrets, but lines 22-23 already define specific verbs for these same resources. The comment indicates these are for "export functionality" and "allow the backend to grant RBAC permissions," but the exact purpose is unclear.

If these wildcard permissions enable the backend to create ClusterRoles/Roles with permissions for these resource types (rather than operating on the resources directly), please clarify this distinction in the comment.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1a3cd0 and 047ba71.

⛔ Files ignored due to path filters (2)
  • .github/workflows/image.yaml is excluded by !**/*.yaml
  • deploy/charts/backend/templates/role.yaml is excluded by !**/*.yaml
📒 Files selected for processing (3)
  • Makefile (4 hunks)
  • backend/controllers/rbac.go (1 hunks)
  • docs/content/setup/helm.md (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-19T05:56:35.969Z
Learnt from: mjudeikis
PR: kube-bind/kube-bind#304
File: backend/controllers/servicenamespace/servicenamespace_reconcile.go:81-98
Timestamp: 2025-09-19T05:56:35.969Z
Learning: In kube-bind, RBAC permissions for PermissionClaims use "*" verbs intentionally. This is a design decision based on: 1) permissions are scoped to consumer-owned provider namespaces, limiting blast radius, 2) bidirectional resource flow requires broad permissions for operations like initial resource creation from consumer side, 3) kube-bind's architecture prioritizes operational simplicity over granular RBAC within the namespace security boundary.

Applied to files:

  • backend/controllers/rbac.go
📚 Learning: 2025-10-24T12:12:18.455Z
Learnt from: ntnn
PR: kube-bind/kube-bind#347
File: Makefile:299-302
Timestamp: 2025-10-24T12:12:18.455Z
Learning: In Makefiles, when a target is explicitly declared with dependencies followed by a pattern rule that matches that target, the explicit declaration adds additional dependencies while the pattern rule provides the recipe. This is valid syntax and the target will execute both the added dependencies and the pattern rule's recipe.

Applied to files:

  • Makefile
🪛 checkmake (0.2.2)
Makefile

[warning] 459-459: Missing required phony target "clean"

(minphony)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: lint
  • GitHub Check: verify
  • GitHub Check: go-test
  • GitHub Check: go-test-e2e
🔇 Additional comments (4)
Makefile (2)

27-30: Well-structured REV and IMAGE_REPO configuration.

The addition of REV (short git SHA) and IMAGE_REPO variables with sensible defaults supports the development workflow suggested in past reviews. The image-local target properly incorporates these into the build output messaging.

Also applies to: 378-400


459-471: helm-test target is well-implemented with proper dry-run validation.

The target correctly depends on helm-build-local and uses --dry-run --debug for safe validation. No issues detected.

backend/controllers/rbac.go (2)

19-24: LGTM: Core RBAC permissions are appropriately scoped.

The RBAC markers for core resources (serviceaccounts, secrets, configmaps, namespaces) and CRDs use specific verbs and are suitable for backend controller operations.


31-34: Wildcard RBAC permissions are intentional and necessary—no action required.

The cluster-wide wildcard permissions (groups=*,resources=*,verbs=*) in backend/controllers/rbac.go line 34 are a required architectural component of kube-bind. The backend controller dynamically creates ClusterRoles with arbitrary permissions for bound resources (as evidenced in backend/controllers/servicenamespace/servicenamespace_reconcile.go lines 102–140). This capability necessitates broad permissions at the controller level.

The learnings provided confirm this is an intentional design decision: broad permissions are scoped operationally to consumer-owned provider namespaces, and the architecture requires bidirectional resource flow capabilities. The code comment at lines 31–33 accurately documents this rationale.

No changes are required. The concern raised in the original review comment reflects a misunderstanding of kube-bind's operational model rather than an actual security oversight.

Likely an incorrect or invalid review comment.

@mjudeikis mjudeikis merged commit 27e0b4c into kbind-dev:main Oct 24, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants