Skip to content

feat: implement multi-provider binding support for CRDs (#173)#594

Open
alokkumardalei-wq wants to merge 1 commit into
kbind-dev:mainfrom
alokkumardalei-wq:feature/issue-173
Open

feat: implement multi-provider binding support for CRDs (#173)#594
alokkumardalei-wq wants to merge 1 commit into
kbind-dev:mainfrom
alokkumardalei-wq:feature/issue-173

Conversation

@alokkumardalei-wq

@alokkumardalei-wq alokkumardalei-wq commented Jul 16, 2026

Copy link
Copy Markdown

Description:

This pull request addresses Issue #173 by adding support for multi-provider bindings in kube-bind. It enables a single consumer cluster to bind and manage Custom Resources from multiple provider clusters without conflict.

Changes made:

API Extensions:

  • Introduced ProviderID string in BindingResourceResponse (sdk/apis/kubebind/v1alpha2/bindingresponse_types.go).
  • Introduced ProviderID (string) and IsDefault (bool) in APIServiceBindingSpec (sdk/apis/kubebind/v1alpha2/apiservicebinding_types.go).
  • Updated CRD definitions via code generation.

Backend:

  • Updated HandleResources in manager.go to retrieve the provider cluster's kube-system namespace UID and set it as ProviderID.
  • Included ProviderID in the BindingResourceResponse payload handled by the HTTP server (handler.go).
  • Populated ProviderID in the BindingResourceResponse secret generated by the UI binding flow in bindableresourcesrequest_controller.go.

CLI Binding Flow:

  • Modified bind-apiservice plugin's createAPIServiceBindings function to map ProviderID and IsDefault into APIServiceBindingSpec.

Konnector Core Engine:

  • Updated servicebindingbundle_reconcile.go to inject the target kube-system UID into the generated APIServiceBinding spec upon reconciling provider connections.
  • Extended spec and status controllers (spec_controller.go and status_controller.go) in pkg/konnector/controllers/cluster/serviceexport/ to filter inbound syncing events. Controllers now only route resources that contain the provider.kube-bind.io/provider-id annotation matching their assigned ProviderID, or any resource if they hold the IsDefault flag.

Testing and Validation

  • Verified via local build (make build) that all integration logic compiles cleanly across both CLI and Backend components.
alokkumardalei@Aloks-MacBook-Air kbind % make build
hack/verify-go-versions.sh
Verifying minimum Go version: 1.26.2
Verifying build Go version: 1.26.2
+ cd ./cmd/
+ go build '-ldflags=-X k8s.io/client-go/pkg/version.gitCommit=da43199 -X k8s.io/client-go/pkg/version.gitTreeState=clean -X k8s.io/client-go/pkg/version.gitVersion=v1.36.0+kube-bind-v0.0.0-da43199 -X k8s.io/client-go/pkg/version.gitMajor=1 -X k8s.io/client-go/pkg/version.gitMinor=36 -X k8s.io/client-go/pkg/version.buildDate=2026-07-17T15:28:45Z -X k8s.io/component-base/version.gitCommit=da43199 -X k8s.io/component-base/version.gitTreeState=clean -X k8s.io/component-base/version.gitVersion=v1.36.0+kube-bind-v0.0.0-da43199 -X k8s.io/component-base/version.gitMajor=1 -X k8s.io/component-base/version.gitMinor=36 -X k8s.io/component-base/version.buildDate=2026-07-17T15:28:45Z' -o /Users/alokkumardalei/Desktop/kbind/kbind/bin/ ./...
+ cd ./cli/cmd/
+ go build '-ldflags=-X k8s.io/client-go/pkg/version.gitCommit=da43199 -X k8s.io/client-go/pkg/version.gitTreeState=clean -X k8s.io/client-go/pkg/version.gitVersion=v1.36.0+kube-bind-v0.0.0-da43199 -X k8s.io/client-go/pkg/version.gitMajor=1 -X k8s.io/client-go/pkg/version.gitMinor=36 -X k8s.io/client-go/pkg/version.buildDate=2026-07-17T15:28:45Z -X k8s.io/component-base/version.gitCommit=da43199 -X k8s.io/component-base/version.gitTreeState=clean -X k8s.io/component-base/version.gitVersion=v1.36.0+kube-bind-v0.0.0-da43199 -X k8s.io/component-base/version.gitMajor=1 -X k8s.io/component-base/version.gitMinor=36 -X k8s.io/component-base/version.buildDate=2026-07-17T15:28:45Z' -o /Users/alokkumardalei/Desktop/kbind/kbind/bin/ ./...
go: downloading k8s.io/cli-runtime v0.36.0
go: downloading k8s.io/component-base v0.36.0
go: downloading github.com/fatih/color v1.19.0
go: downloading k8s.io/client-go v0.36.0
go: downloading github.com/MakeNowJust/heredoc v1.0.0
go: downloading github.com/muesli/reflow v0.3.0
go: downloading github.com/moby/moby/client v0.4.1
go: downloading helm.sh/helm/v3 v3.20.2
go: downloading k8s.io/apimachinery v0.36.0
go: downloading sigs.k8s.io/kind v0.31.0
go: downloading k8s.io/api v0.36.0
go: downloading github.com/mattn/go-colorable v0.1.14
go: downloading github.com/mattn/go-isatty v0.0.21
go: downloading github.com/containerd/errdefs/pkg v0.3.0
go: downloading github.com/containerd/errdefs v1.0.0
go: downloading github.com/distribution/reference v0.6.0
go: downloading github.com/docker/go-connections v0.7.0
go: downloading github.com/moby/moby/api v1.54.2
go: downloading github.com/opencontainers/image-spec v1.1.1
go: downloading github.com/opencontainers/go-digest v1.0.0
go: downloading github.com/Masterminds/semver/v3 v3.4.0
go: downloading github.com/Masterminds/sprig/v3 v3.3.0
go: downloading github.com/gosuri/uitable v0.0.4
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/containerd/containerd v1.7.33
go: downloading oras.land/oras-go/v2 v2.6.0
go: downloading github.com/evanphx/json-patch v5.9.11+incompatible
go: downloading github.com/mattn/go-runewidth v0.0.23
go: downloading github.com/docker/go-units v0.5.0
go: downloading github.com/moby/docker-image-spec v1.3.1
go: downloading github.com/cyphar/filepath-securejoin v0.6.1
go: downloading github.com/mitchellh/copystructure v1.2.0
go: downloading github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
go: downloading github.com/BurntSushi/toml v1.6.0
go: downloading github.com/gobwas/glob v0.2.3
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading k8s.io/kubectl v0.36.0
go: downloading github.com/Masterminds/squirrel v1.5.4
go: downloading github.com/jmoiron/sqlx v1.4.0
go: downloading github.com/lib/pq v1.12.3
go: downloading github.com/rubenv/sql-migrate v1.8.1
go: downloading dario.cat/mergo v1.0.2
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading github.com/huandu/xstrings v1.5.0
go: downloading github.com/shopspring/decimal v1.4.0
go: downloading github.com/spf13/cast v1.10.0
go: downloading al.essio.dev/pkg/shellescape v1.6.0
go: downloading github.com/pelletier/go-toml v1.9.5
go: downloading github.com/mitchellh/reflectwalk v1.0.2
go: downloading github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
go: downloading k8s.io/apiserver v0.36.0
go: downloading github.com/clipperhouse/uax29/v2 v2.7.0
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/containerd/log v0.1.0
go: downloading github.com/containerd/platforms v0.2.1
go: downloading github.com/lann/builder v0.0.0-20180802200727-47ae307949d0
go: downloading github.com/go-gorp/gorp/v3 v3.1.0
go: downloading github.com/sirupsen/logrus v1.9.4
go: downloading github.com/klauspost/compress v1.18.5
go: downloading github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f
go: downloading github.com/chai2010/gettext-go v1.0.3
go: downloading github.com/mitchellh/go-wordwrap v1.0.1
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0
+ cd ./contrib/kcp/cmd/kcp-init/
+ go build '-ldflags=-X k8s.io/client-go/pkg/version.gitCommit=da43199 -X k8s.io/client-go/pkg/version.gitTreeState=clean -X k8s.io/client-go/pkg/version.gitVersion=v1.36.0+kube-bind-v0.0.0-da43199 -X k8s.io/client-go/pkg/version.gitMajor=1 -X k8s.io/client-go/pkg/version.gitMinor=36 -X k8s.io/client-go/pkg/version.buildDate=2026-07-17T15:28:45Z -X k8s.io/component-base/version.gitCommit=da43199 -X k8s.io/component-base/version.gitTreeState=clean -X k8s.io/component-base/version.gitVersion=v1.36.0+kube-bind-v0.0.0-da43199 -X k8s.io/component-base/version.gitMajor=1 -X k8s.io/component-base/version.gitMinor=36 -X k8s.io/component-base/version.buildDate=2026-07-17T15:28:45Z' -o /Users/alokkumardalei/Desktop/kbind/kbind/bin/ ./...
go: downloading github.com/kcp-dev/kubernetes/staging/src/k8s.io/apiserver v0.0.0-20260401063412-ba4f7d493d5b
go: downloading github.com/kcp-dev/kubernetes/staging/src/k8s.io/component-base v0.0.0-20260401063412-ba4f7d493d5b
go: downloading github.com/kcp-dev/client-go v0.31.0
go: downloading github.com/kcp-dev/kubernetes/staging/src/k8s.io/apimachinery v0.0.0-20260401063412-ba4f7d493d5b
go: downloading github.com/kcp-dev/kubernetes/staging/src/k8s.io/client-go v0.0.0-20260401063412-ba4f7d493d5b
go: downloading github.com/kcp-dev/kcp v0.31.0
go: downloading github.com/kcp-dev/kubernetes/staging/src/k8s.io/apiextensions-apiserver v0.0.0-20260401063412-ba4f7d493d5b
go: downloading github.com/kcp-dev/kubernetes/staging/src/k8s.io/api v0.0.0-20260401063412-ba4f7d493d5b
go: downloading golang.org/x/crypto v0.51.0
go: downloading golang.org/x/net v0.55.0
go: downloading golang.org/x/sys v0.45.0
go: downloading golang.org/x/term v0.43.0
go: downloading golang.org/x/text v0.37.0
  • Ran make test locally to ensure no pre-existing component behaviors were negatively impacted. All changes cleanly integrate with existing dynamic resource syncing logic.
         github.com/kube-bind/kube-bind/backend          coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/auth             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/client           coverage: 0.0% of statements
?       github.com/kube-bind/kube-bind/backend/controllers      [no test files]
        github.com/kube-bind/kube-bind/backend/controllers/bindableresourcesrequest             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/controllers/cluster              coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/controllers/clusterbinding               coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/controllers/serviceexport                coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/backend/controllers/serviceexportrbac    1.489s  coverage: 51.2% of statements
        github.com/kube-bind/kube-bind/backend/controllers/serviceexportrequest         coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/controllers/servicenamespace             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/deploy           coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/http             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/kubernetes               coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/backend/kubernetes/resources     2.495s  coverage: 4.7% of statements
ok      github.com/kube-bind/kube-bind/backend/oidc     2.222s  coverage: 33.3% of statements
ok      github.com/kube-bind/kube-bind/backend/options  1.417s  coverage: 9.6% of statements
        github.com/kube-bind/kube-bind/backend/options/session/redis            coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/provider/kcp             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/provider/kcp/controllers/apibindingtemplate              coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/provider/kcp/controllers/apiresourceschema               coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/provider/kcp/controllers/shared          coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/provider/kcp/controllers/vwrbac          coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/provider/kcp/options             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/session          coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/backend/session/memory           coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/backend/session/redis    1.384s  coverage: 81.1% of statements
        github.com/kube-bind/kube-bind/backend/spaserver                coverage: 0.0% of statements
?       github.com/kube-bind/kube-bind/backend/template [no test files]
        github.com/kube-bind/kube-bind/cmd/backend              coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/cmd/konnector            coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/cmd/konnector/cmd                coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/deploy/crd               coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/deploy/examples          coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/bootstrap            coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/committer            coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/indexers             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector            coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster                coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/claimedresources       1.426s  coverage: 5.7% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/claimedresourcesnamespaces          coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/clusterbinding         coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/namespacelifecycle             coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/servicebinding 1.586s  coverage: 21.2% of statements
ok      github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/serviceexport  1.949s  coverage: 3.2% of statements
ok      github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/serviceexport/isolation        2.285scoverage: 5.6% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/serviceexport/multinsinformer       coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/serviceexport/spec     2.612s  coverage: 3.8% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/cluster/serviceexport/status           coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/contextstore           coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/dynamic                coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/servicebinding         coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/controllers/servicebindingbundle           coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/options            coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/server             coverage: 0.0% of statements
        github.com/kube-bind/kube-bind/pkg/konnector/types              coverage: 0.0% of statements
ok      github.com/kube-bind/kube-bind/pkg/resources    2.572s  coverage: 57.4% of statements
ok      github.com/kube-bind/kube-bind/pkg/version      2.857s  coverage: 88.9% of statements

Fixes #173

Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
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.

Binding multiple provider with same CRD into one consumer cluster

1 participant