From 9e57e7941f50b1798f14097c2b1baa15083ce8e0 Mon Sep 17 00:00:00 2001 From: Mangirdas Judeikis Date: Wed, 24 Sep 2025 09:49:11 +0300 Subject: [PATCH] Update docs for v0.5 Signed-off-by: Mangirdas Judeikis On-behalf-of: @SAP mangirdas.judeikis@sap.com --- Makefile | 2 +- README.md | 25 +- backend/config.go | 4 +- backend/provider/provider.go | 25 ++ .../resources/apiexport-kube-bind.io.yaml | 2 +- ...ceschema-clusterbindings.kube-bind.io.yaml | 6 +- deploy/crd/kube-bind.io_clusterbindings.yaml | 4 +- docs/content/developers/backend/index.md | 64 +++++ .../controllers/cluster/apiserviceexport.md | 14 +- .../controllers/cluster/boundschema.md | 42 ++++ docs/content/setup/index.md | 29 +++ docs/content/setup/kcp-setup.md | 237 ++++++++++++++++++ docs/content/setup/quickstart.md | 15 +- docs/generators/crd-ref/run-crd-ref-gen.sh | 2 +- go.mod | 4 +- go.sum | 8 +- .../v1alpha1/apiserviceexport_types.go | 1 - .../kubebind/v1alpha1/clusterbinding_types.go | 4 +- 18 files changed, 452 insertions(+), 36 deletions(-) create mode 100644 backend/provider/provider.go create mode 100644 docs/content/developers/konnector/controllers/cluster/boundschema.md create mode 100644 docs/content/setup/kcp-setup.md diff --git a/Makefile b/Makefile index 9dc78dd4a..06ca1e3e4 100644 --- a/Makefile +++ b/Makefile @@ -77,7 +77,7 @@ CODE_GENERATOR_BIN := code-generator CODE_GENERATOR := $(TOOLS_GOBIN_DIR)/$(CODE_GENERATOR_BIN)-$(CODE_GENERATOR_VER) export CODE_GENERATOR # so hack scripts can use it -KCP_VER := v0.28.1 +KCP_VER := v0.28.0 KCP_BIN := kcp KCP := $(TOOLS_GOBIN_DIR)/$(KCP_BIN)-$(KCP_VER) KCP_CMD ?= $(KCP) diff --git a/README.md b/README.md index 0f1af7403..a896fdd9c 100644 --- a/README.md +++ b/README.md @@ -62,23 +62,28 @@ All the actions shown between the clusters are done by the konnector, except: th To get familiar with setting up the environment, please check out docs at [kube-bind.io](https://docs.kube-bind.io/main/setup). -## API Changes in coming v0.5.0 release +## API Changes in v0.5.0 release Version v0.5.0 includes significant architectural improvements to the API structure: ### Major Changes -- **API Version Upgrade**: Introduced `v1alpha2` API version with improved stability and features -- **Service Exposure Refactoring**: Completely refactored the service exposure mechanism to use: - - `APIResourceSchema`: Define the schema of exported CRDs, allowing one APIServiceExport to reference multiple CRDs. - - `BoundAPIResourceSchema`: Represent bound schemas in consumer clusters and underlying status of synced resources. +- **API Version Upgrade**: Introduced `v1alpha2` API version alongside existing `v1alpha1` +- **Service Exposure Refactoring**: Refactored the service exposure mechanism from embedded CRD specifications to a resource-based model: + - `APIServiceExportSpec` now uses `Resources []APIServiceExportResource` instead of embedded CRD specs + - `BoundSchema`: New resource type in `v1alpha2` that represents bound schemas in consumer clusters and tracks the status of synced resources + - This allows one APIServiceExport to reference multiple CRDs more efficiently + +### Backend Architecture Improvements + +- **MultiCluster Runtime Integration**: The backend now leverages `sigs.k8s.io/multicluster-runtime` for enhanced cluster management capabilities +- **Provider Support**: Built-in support for multiple backend providers including KCP through `github.com/kcp-dev/multicluster-provider` +- **Enhanced Cluster Operations**: Improved cluster-aware resource management with dedicated manager architecture for handling multi-cluster scenarios ### Limitations These limitations are part of the roadmap and will be addressed in the future. -* Currently we don't support related resources, like ConfigMaps, Secrets -* Currently CRD resources MUST be installed in the provider cluster, even when APIResourceSchema is used. - This is to allow the konnector to sync instances of the CRD to the consumer cluster. - This should be removed once we introduce sync policies and object wrappers. -* Currently we dont support granular permissions, like only allow to read/write certain named resources. +* Currently we don't support related resources, like ConfigMaps, Secrets. +* We don't support lifecycle of `BoundSchema` resources, like schema changes. +* Currently multicluster-runtime dependency is pointing to a fork, we will work on getting the changes merged upstream. See [PR](https://github.com/kubernetes-sigs/multicluster-runtime/pull/62) for details. \ No newline at end of file diff --git a/backend/config.go b/backend/config.go index 953294735..d15a539ec 100644 --- a/backend/config.go +++ b/backend/config.go @@ -35,10 +35,10 @@ import ( ctrlconfig "sigs.k8s.io/controller-runtime/pkg/config" metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" mcmanager "sigs.k8s.io/multicluster-runtime/pkg/manager" - "sigs.k8s.io/multicluster-runtime/pkg/multicluster" kuberesources "github.com/kube-bind/kube-bind/backend/kubernetes/resources" "github.com/kube-bind/kube-bind/backend/options" + "github.com/kube-bind/kube-bind/backend/provider" kubebindv1alpha1 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha1" kubebindv1alpha2 "github.com/kube-bind/kube-bind/sdk/apis/kubebind/v1alpha2" ) @@ -46,7 +46,7 @@ import ( type Config struct { Options *options.CompletedOptions - Provider multicluster.Provider + Provider provider.MultiClusterProvider ExternalAddressGenerator kuberesources.ExternalAddreesGeneratorFunc Manager mcmanager.Manager Scheme *runtime.Scheme diff --git a/backend/provider/provider.go b/backend/provider/provider.go new file mode 100644 index 000000000..30770c630 --- /dev/null +++ b/backend/provider/provider.go @@ -0,0 +1,25 @@ +/* +Copyright 2025 The Kube Bind Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package provider + +import "sigs.k8s.io/multicluster-runtime/pkg/multicluster" + +// MultiClusterProvider is an interface that combines multicluster.Provider and multicluster.ProviderRunnable. +type MultiClusterProvider interface { + multicluster.Provider + multicluster.ProviderRunnable +} diff --git a/contrib/kcp/deploy/resources/apiexport-kube-bind.io.yaml b/contrib/kcp/deploy/resources/apiexport-kube-bind.io.yaml index 54d8a7688..e0db92618 100644 --- a/contrib/kcp/deploy/resources/apiexport-kube-bind.io.yaml +++ b/contrib/kcp/deploy/resources/apiexport-kube-bind.io.yaml @@ -74,7 +74,7 @@ spec: crd: {} - group: kube-bind.io name: clusterbindings - schema: v250809-5ed76a1.clusterbindings.kube-bind.io + schema: v250925-56669b8.clusterbindings.kube-bind.io storage: crd: {} status: {} diff --git a/contrib/kcp/deploy/resources/apiresourceschema-clusterbindings.kube-bind.io.yaml b/contrib/kcp/deploy/resources/apiresourceschema-clusterbindings.kube-bind.io.yaml index b9189319c..85cd9bd1a 100644 --- a/contrib/kcp/deploy/resources/apiresourceschema-clusterbindings.kube-bind.io.yaml +++ b/contrib/kcp/deploy/resources/apiresourceschema-clusterbindings.kube-bind.io.yaml @@ -2,7 +2,7 @@ apiVersion: apis.kcp.io/v1alpha1 kind: APIResourceSchema metadata: creationTimestamp: null - name: v250809-5ed76a1.clusterbindings.kube-bind.io + name: v250925-56669b8.clusterbindings.kube-bind.io spec: conversion: strategy: None @@ -32,8 +32,8 @@ spec: name: v1alpha1 schema: description: |- - ClusterBinding represents a bound consumer cluster. It lives in a service - provider cluster and is a singleton named "cluster" per namespace. + ClusterBinding represents a bound consumer cluster. It lives in a service provider cluster + and is a singleton named "cluster". properties: apiVersion: description: |- diff --git a/deploy/crd/kube-bind.io_clusterbindings.yaml b/deploy/crd/kube-bind.io_clusterbindings.yaml index b8f11e26d..b9c3b5028 100644 --- a/deploy/crd/kube-bind.io_clusterbindings.yaml +++ b/deploy/crd/kube-bind.io_clusterbindings.yaml @@ -34,8 +34,8 @@ spec: schema: openAPIV3Schema: description: |- - ClusterBinding represents a bound consumer cluster. It lives in a service - provider cluster and is a singleton named "cluster" per namespace. + ClusterBinding represents a bound consumer cluster. It lives in a service provider cluster + and is a singleton named "cluster". properties: apiVersion: description: |- diff --git a/docs/content/developers/backend/index.md b/docs/content/developers/backend/index.md index 781894a4f..75903e32b 100644 --- a/docs/content/developers/backend/index.md +++ b/docs/content/developers/backend/index.md @@ -1 +1,65 @@ # Backend + +The kube-bind backend provides service export and binding capabilities for single Kubernetes clusters acting as backend or many clusters with support for multiple cluster providers through the multicluster-runtime architecture. + +## Architecture + +Starting with v0.5.0, the backend leverages `sigs.k8s.io/multicluster-runtime` for enhanced cluster management capabilities. + +### Key Components + +- **MultiCluster Runtime Integration**: Built on `sigs.k8s.io/multicluster-runtime` for provider-agnostic cluster operations +- **Provider Support**: Extensible provider system supporting different backend implementations +- **Manager Architecture**: Uses `mcmanager.Manager` for cluster-aware resource management + +### Supported Providers + +- **Default Provider**: Standard Kubernetes cluster support +- **KCP Provider**: Integration with [kcp](https://github.com/kcp-dev/kcp) through `github.com/kcp-dev/multicluster-provider` + +## Configuration + +The backend can be configured to use different providers: + +```bash +./bin/backend \ + --multicluster-runtime-provider kcp \ + --server-url=$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}") \ + # ... other options +``` + +### Provider Configuration + +#### KCP Provider + +When using the KCP provider (`--multicluster-runtime-provider kcp`), the backend: + +- Connects to kcp workspaces through APIExports +- Manages resources across logical clusters +- Supports advanced multi-tenancy features +- Enables workspace-based isolation + +#### Default Provider + +The default provider works with standard Kubernetes clusters and provides: + +- Direct cluster connectivity +- Namespace-based isolation +- Standard RBAC integration + +## API Changes + +The backend now supports the v1alpha2 API with significant architectural improvements: + +- **Resource-Based Exports**: APIServiceExport now uses resource references instead of embedded CRDs +- **BoundSchema Support**: Integration with BoundSchema resources for better schema management +- **Multi-Resource Support**: Single exports can reference multiple CRDs efficiently + +## Controllers + +The backend includes several controllers for managing the export/binding lifecycle: + +- **ClusterBinding Controller**: Manages cluster binding lifecycle +- **ServiceExport Controller**: Handles APIServiceExport resources +- **ServiceExportRequest Controller**: Processes export requests +- **ServiceNamespace Controller**: Manages namespace isolation diff --git a/docs/content/developers/konnector/controllers/cluster/apiserviceexport.md b/docs/content/developers/konnector/controllers/cluster/apiserviceexport.md index f1de2f508..59c419668 100644 --- a/docs/content/developers/konnector/controllers/cluster/apiserviceexport.md +++ b/docs/content/developers/konnector/controllers/cluster/apiserviceexport.md @@ -1,13 +1,21 @@ # APIServiceExports -The APIServiceExport controller watches `APIServiceExports` and the referenced `CustomResourceDefinitions` (CRDs) in the **provider cluster**. +The APIServiceExport controller watches `APIServiceExports` and the referenced resources in the **provider cluster**. -It is responsible for: +Starting with v1alpha2, the APIServiceExport has been refactored to use a resource-based model instead of embedded CRD specifications. + +## Key Changes in v1alpha2 + +- **Resource-Based Model**: `APIServiceExportSpec` now uses `Resources []APIServiceExportResource` instead of embedded CRD specs +- **Multi-Resource Support**: One APIServiceExport can reference multiple CRDs more efficiently +- **BoundSchema Integration**: Works with the new `BoundSchema` resource type for tracking bound schemas in consumer clusters + +## Controller Responsibilities * Ensuring the existence and validity of `APIServiceExports`. * Managing the lifecycle of `APIServiceExports` by starting and stopping spec and status syncers and controllers. * Checking `APIServiceBinding` condition and setting `ConsumerInSync` condition in `APIServiceExport` -* Copying conditions from the referenced CRDs to the `APIServiceExport` status. +* Managing resource references and their associated schemas. ## Overview diff --git a/docs/content/developers/konnector/controllers/cluster/boundschema.md b/docs/content/developers/konnector/controllers/cluster/boundschema.md new file mode 100644 index 000000000..cb3955b53 --- /dev/null +++ b/docs/content/developers/konnector/controllers/cluster/boundschema.md @@ -0,0 +1,42 @@ +# BoundSchema + +The BoundSchema controller manages `BoundSchema` resources in the consumer cluster, introduced in v1alpha2. + +`BoundSchema` represents bound API resource schemas in consumer clusters and tracks the underlying status of synced resources. + +## Key Features + +- **Schema Validation**: Ensures the bound schema is valid and properly applied +- **Drift Detection**: Monitors for differences between expected and actual schema state +- **Condition Management**: Provides status conditions for validation and drift detection + +## BoundSchema Structure + +```yaml +apiVersion: kube-bind.io/v1alpha2 +kind: BoundSchema +metadata: + labels: + kube-bind.io/exported: "true" + name: cowboys.wildwest.dev + namespace: kube-bind-flsd8 +spec: + group: wildwest.dev + informerScope: Namespaced + names: + kind: Cowboy + listKind: CowboyList + plural: cowboys + singular: cowboy + scope: Namespaced + versions: ... +``` + +## Integration with APIServiceExport + +BoundSchema works closely with the APIServiceExport resource-based model: + +1. APIServiceExport references multiple resources via `Resources []APIServiceExportResource` +2. Each resource can map to a BoundSchema in the consumer cluster +3. BoundSchema tracks the actual application and status of these schemas +4. This enables better multi-resource management and status tracking \ No newline at end of file diff --git a/docs/content/setup/index.md b/docs/content/setup/index.md index b3f93cb6f..b6adf12c3 100644 --- a/docs/content/setup/index.md +++ b/docs/content/setup/index.md @@ -1,3 +1,32 @@ # Setting Up kube-bind +kube-bind supports multiple deployment scenarios and backend providers to meet different requirements. + +## Setup Options + +### Standard Kubernetes Setup + +- **[Quickstart](quickstart.md)**: Get started quickly with the default provider +- **[Helm Deployment](helm.md)**: Production deployment using Helm charts +- **[Local Setup with Kind](local-setup-with-kind.md)**: Local development environment +- **[kubectl Plugin](kubectl-plugin.md)**: Install and use the kubectl-bind plugin + +### Advanced Multi-Cluster Setup + +- **[KCP Integration](kcp-setup.md)**: Advanced multi-tenant setup with kcp workspaces and APIExports + +## Architecture Overview + +Starting with v0.5.0, kube-bind uses a multicluster-runtime architecture that supports: + +- **Multiple Providers**: Choose between standard Kubernetes or KCP backends +- **Enhanced API**: v1alpha2 API with resource-based exports and BoundSchema support +- **Flexible Deployment**: Support for various cluster topologies and requirements + +Choose the setup that best fits your use case: + +- Use **Quickstart** or **Local Setup with Kind** for development and testing +- Use **Helm Deployment** for production environments with standard Kubernetes +- Use **KCP Integration** for advanced multi-tenant scenarios with workspace isolation + {% include "partials/section-overview.html" %} diff --git a/docs/content/setup/kcp-setup.md b/docs/content/setup/kcp-setup.md new file mode 100644 index 000000000..acafaf455 --- /dev/null +++ b/docs/content/setup/kcp-setup.md @@ -0,0 +1,237 @@ +--- +description: > + Set up kube-bind with KCP provider for advanced multi-cluster scenarios. +--- + +# kcp Setup + +This guide shows how to set up kube-bind with the kcp provider, which enables advanced multi-cluster and multi-tenant scenarios through kcp workspaces. + +## Overview + +The kcp provider integrates kube-bind with [kcp](https://github.com/kcp-dev/kcp), enabling: + +- **Workspace-based isolation**: Each binding can operate in isolated kcp workspaces +- **Advanced multi-tenancy**: Provider and consumer separation through logical clusters where backend can be in single workspace or multiple workspaces +- **APIExport integration**: Leverages kcp's APIExport mechanism for service exposure +- **Scalable architecture**: Supports large-scale multi-cluster deployments + +## Prerequisites + +- [kcp](https://github.com/kcp-dev/kcp) instance running and accessible +- [dex](https://github.com/dexidp/dex) for OIDC authentication +- kube-bind binaries built (`make build`) + +## Setup Steps + +### 1. Start KCP + +```bash +make run-kcp +``` + +### 2. Start Dex OIDC Provider + +Clone and configure dex: + +```bash +git clone https://github.com/dexidp/dex.git +cd dex && make build +``` + +Configure dex (`examples/config-dev.yaml`): + +```yaml +staticClients: +- id: kube-bind + redirectURIs: + - 'http://127.0.0.1:8080/callback' + name: 'Kube Bind' + secret: ZXhhbXBsZS1hcHAtc2VjcmV0 +``` + +Start dex: + +```bash +./bin/dex serve examples/config-dev.yaml +``` + +### 3. Bootstrap KCP + +Create the kube-bind provider workspace and APIExport: + +```bash +cp .kcp/admin.kubeconfig .kcp/backend.kubeconfig +export KUBECONFIG=.kcp/backend.kubeconfig +./bin/kcp-init --kcp-kubeconfig $KUBECONFIG +``` + +### 4. Start Backend with KCP Provider + +Switch to the kube-bind workspace: + +```bash +kubectl ws use :root:kube-bind +``` + +Start the backend with KCP provider: + +```bash +./bin/backend \ + --multicluster-runtime-provider kcp \ + --server-url=$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}") \ + --oidc-issuer-client-secret=ZXhhbXBsZS1hcHAtc2VjcmV0 \ + --oidc-issuer-client-id=kube-bind \ + --oidc-issuer-url=http://127.0.0.1:5556/dex \ + --oidc-callback-url=http://127.0.0.1:8080/callback \ + --pretty-name="BigCorp.com" \ + --namespace-prefix="kube-bind-" \ + --cookie-signing-key=bGMHz7SR9XcI9JdDB68VmjQErrjbrAR9JdVqjAOKHzE= \ + --cookie-encryption-key=wadqi4u+w0bqnSrVFtM38Pz2ykYVIeeadhzT34XlC1Y= \ + --schema-source apiresourceschemas +``` + +### 5. Create Provider Workspace + +Create a provider workspace for hosting services: + +```bash +cp .kcp/admin.kubeconfig .kcp/provider.kubeconfig +export KUBECONFIG=.kcp/provider.kubeconfig +kubectl ws use :root +kubectl ws create provider --enter +``` + +### 6. Bind APIExport to Provider + +Bind the kube-bind APIExport to the provider workspace: + +```bash +kubectl kcp bind apiexport root:kube-bind:kube-bind.io \ + --accept-permission-claim clusterrolebindings.rbac.authorization.k8s.io \ + --accept-permission-claim clusterroles.rbac.authorization.k8s.io \ + --accept-permission-claim customresourcedefinitions.apiextensions.k8s.io \ + --accept-permission-claim serviceaccounts.core \ + --accept-permission-claim configmaps.core \ + --accept-permission-claim secrets.core \ + --accept-permission-claim namespaces.core \ + --accept-permission-claim roles.rbac.authorization.k8s.io \ + --accept-permission-claim rolebindings.rbac.authorization.k8s.io \ + --accept-permission-claim apiresourceschemas.apis.kcp.io +``` + +### 7. Create Example Resources + +Deploy example APIExport and APIResourceSchemas: + +```bash +kubectl create -f contrib/kcp/deploy/examples/apiexport.yaml +kubectl create -f contrib/kcp/deploy/examples/apiresourceschema-cowboys.yaml +kubectl create -f contrib/kcp/deploy/examples/apiresourceschema-sheriffs.yaml + +# Enable recursive binding +kubectl kcp bind apiexport root:provider:cowboys-stable +``` + +### 8. Get Logical Cluster Information + +Retrieve the logical cluster URL for consumer setup: + +```bash +kubectl get logicalcluster +# NAME PHASE URL AGE +# cluster Ready https://192.168.2.166:6443/clusters/2xh2v3gzjhn4tmve +``` + +## Consumer Setup + +### 1. Create Consumer Workspace + +```bash +cp .kcp/admin.kubeconfig .kcp/consumer.kubeconfig +export KUBECONFIG=.kcp/consumer.kubeconfig +kubectl ws use :root +kubectl ws create consumer --enter +``` + +### 2. Perform Binding + +Generate the APIServiceExport YAML: + +```bash +./bin/kubectl-bind http://127.0.0.1:8080/clusters//exports --dry-run -o yaml > apiserviceexport.yaml +``` + +Extract the kubeconfig for binding: + +```bash +kubectl get secret -n kube-bind -o jsonpath='{.data.kubeconfig}' | base64 -d > remote.kubeconfig +``` + +Perform the binding: + +```bash +./bin/kubectl-bind apiservice \ + --remote-kubeconfig remote.kubeconfig \ + -f apiserviceexport.yaml \ + --skip-konnector \ + --remote-namespace kube-bind- +``` + +### 3. Start Konnector + +```bash +export KUBECONFIG=.kcp/consumer.kubeconfig +go run ./cmd/konnector/ --lease-namespace default +``` + +### 4. Test the Setup + +Create example resources: + +```bash +kubectl apply -f contrib/kcp/deploy/examples/cowboy.yaml +``` + +## Advanced Features + +### Multiple Consumers + +You can create multiple consumer workspaces to test multi-tenant scenarios: + +```bash +# Create second consumer +cp .kcp/admin.kubeconfig .kcp/consumer2.kubeconfig +export KUBECONFIG=.kcp/consumer2.kubeconfig +kubectl ws use :root +kubectl ws create consumer2 --enter + +# Repeat binding process with different namespace +# Start konnector on different port +go run ./cmd/konnector/ --lease-namespace default --server-address :8091 +``` + +### Debugging + +To debug the setup, use the following commands: + +```bash +# Switch to debug workspace +cp .kcp/admin.kubeconfig .kcp/debug.kubeconfig +export KUBECONFIG=.kcp/debug.kubeconfig +kubectl ws use :root:kube-bind + +# Check available resources +kubectl-s "$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}")/clusters/*" api-resources + +# List CRDs +kubectl-s "$(kubectl get apiexportendpointslice kube-bind.io -o jsonpath="{.status.endpoints[0].url}")/clusters/*" get crd +``` + +## Key Differences from Standard Setup + +- **Provider Selection**: Uses `--multicluster-runtime-provider kcp` flag +- **Workspace Management**: Requires kcp workspace creation and management +- **APIExport Integration**: Leverages kcp's APIExport mechanism to enable shared backed service. +- **URL Structure**: Uses kcp-specific URLs with cluster identifiers. In production, this should be abstracted by a service wrapper. +- **Advanced Isolation**: Provides workspace-level isolation beyond namespaces \ No newline at end of file diff --git a/docs/content/setup/quickstart.md b/docs/content/setup/quickstart.md index 5550c6802..8a252db91 100644 --- a/docs/content/setup/quickstart.md +++ b/docs/content/setup/quickstart.md @@ -11,11 +11,18 @@ description: > ## Start with Kube-Bind -This section allows you to run local kube-bind backend and konnector. -The main challenge when running it locally is to have multiple clusters available and accessible. +This section allows you to run local kube-bind backend and konnector with the standard Kubernetes provider. -For this we use [kcp](https://github.com/kcp-dev/kcp) to create a local clusters under single kcp instance. -By having a single kcp instance, we can have multiple clusters available and accessible via same url. +Starting with v0.5.0, kube-bind supports multiple backend providers through multicluster-runtime: + +- **Standard Provider** (default): Works with regular Kubernetes clusters +- **KCP Provider**: Advanced multi-tenant setup with kcp workspaces (see [KCP Setup Guide](kcp-setup.md)) + +This quickstart uses the default provider. For kcp integration, see the [KCP Setup Guide](kcp-setup.md). + +### Using KCP for Local Development + +For local development, we use [kcp](https://github.com/kcp-dev/kcp) to create multiple logical clusters under a single kcp instance, making them available and accessible via the same URL. To run kcp, you need to have a kcp binary. diff --git a/docs/generators/crd-ref/run-crd-ref-gen.sh b/docs/generators/crd-ref/run-crd-ref-gen.sh index ba68125fa..7137c5af4 100755 --- a/docs/generators/crd-ref/run-crd-ref-gen.sh +++ b/docs/generators/crd-ref/run-crd-ref-gen.sh @@ -21,7 +21,7 @@ set -o xtrace REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd) -CONTAINER_ENGINE=${CONTAINER_ENGINE:-podman} +CONTAINER_ENGINE=${CONTAINER_ENGINE:-docker} CRD_DOCS_GENERATOR_VERSION=0.10.0 #TODO(ncdc): i18n diff --git a/go.mod b/go.mod index 4d5523919..df97de96d 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ replace ( replace ( github.com/google/cel-go => github.com/google/cel-go v0.22.0 github.com/kcp-dev/apimachinery/v2 => github.com/kcp-dev/apimachinery/v2 v2.0.1-0.20250728122101-adbf20db3e51 - github.com/kcp-dev/multicluster-provider => github.com/mjudeikis/kcp-multicluster-provider v0.0.0-20250818102159-3d31cbb06ebe + github.com/kcp-dev/multicluster-provider => github.com/mjudeikis/kcp-multicluster-provider v0.0.0-20250924135430-a1b0eea41697 k8s.io/api => k8s.io/api v0.33.0 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.33.0 k8s.io/apimachinery => k8s.io/apimachinery v0.33.0 @@ -24,7 +24,7 @@ replace ( k8s.io/component-base => k8s.io/component-base v0.33.0 sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.21.0 //sigs.k8s.io/multicluster-runtime => sigs.k8s.io/multicluster-runtime v0.20.4-alpha.7 - sigs.k8s.io/multicluster-runtime => github.com/mjudeikis/sigs-multicluster-runtime v0.0.0-20250818101434-d8ebc45e169b + sigs.k8s.io/multicluster-runtime => github.com/mjudeikis/sigs-multicluster-runtime v0.0.0-20250924135253-419f38e2cced ) require ( diff --git a/go.sum b/go.sum index eeab65ea7..43d608710 100644 --- a/go.sum +++ b/go.sum @@ -163,10 +163,10 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mdp/qrterminal/v3 v3.2.0 h1:qteQMXO3oyTK4IHwj2mWsKYYRBOp1Pj2WRYFYYNTCdk= github.com/mdp/qrterminal/v3 v3.2.0/go.mod h1:XGGuua4Lefrl7TLEsSONiD+UEjQXJZ4mPzF+gWYIJkk= -github.com/mjudeikis/kcp-multicluster-provider v0.0.0-20250818102159-3d31cbb06ebe h1:rSMxNO43EhRCu49OxJrcueT3x8QJdtDgg9QNsjj8UCI= -github.com/mjudeikis/kcp-multicluster-provider v0.0.0-20250818102159-3d31cbb06ebe/go.mod h1:AQbVcrm76lpSFQ/8Gkbf0ev1eTqbk+dynDw6IW8oprA= -github.com/mjudeikis/sigs-multicluster-runtime v0.0.0-20250818101434-d8ebc45e169b h1:rWXhKkj+BFmR08VYCRVW1/5n+PgKAzcrueYVPjN3K/g= -github.com/mjudeikis/sigs-multicluster-runtime v0.0.0-20250818101434-d8ebc45e169b/go.mod h1:CpBzLMLQKdm+UCchd2FiGPiDdCxM5dgCCPKuaQ6Fsv0= +github.com/mjudeikis/kcp-multicluster-provider v0.0.0-20250924135430-a1b0eea41697 h1:JD5KZQ2Wgd1YpMkHZHjWnY1vN7Tum2mS21hFalsluTs= +github.com/mjudeikis/kcp-multicluster-provider v0.0.0-20250924135430-a1b0eea41697/go.mod h1:Z+mhTzOrNasK0Tcb3dryZAm8Qen16X8ExCGlHAe21cw= +github.com/mjudeikis/sigs-multicluster-runtime v0.0.0-20250924135253-419f38e2cced h1:QQeHizakPBEsphr3NomO+SPRIU8V3IgpSGr/V4Ttuy0= +github.com/mjudeikis/sigs-multicluster-runtime v0.0.0-20250924135253-419f38e2cced/go.mod h1:CpBzLMLQKdm+UCchd2FiGPiDdCxM5dgCCPKuaQ6Fsv0= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/sdk/apis/kubebind/v1alpha1/apiserviceexport_types.go b/sdk/apis/kubebind/v1alpha1/apiserviceexport_types.go index 1a9a6a975..8209ab966 100644 --- a/sdk/apis/kubebind/v1alpha1/apiserviceexport_types.go +++ b/sdk/apis/kubebind/v1alpha1/apiserviceexport_types.go @@ -168,7 +168,6 @@ type APIServiceExportVersion struct { // +required // +kubebuilder:validation:Required Storage bool `json:"storage"` - //nolint:gocritic // deprecatedComment: the proper format is // deprecated indicates this version of the custom resource API is deprecated. // When set to true, API requests to this version receive a warning header in the server response. diff --git a/sdk/apis/kubebind/v1alpha1/clusterbinding_types.go b/sdk/apis/kubebind/v1alpha1/clusterbinding_types.go index 76414258c..8882846e5 100644 --- a/sdk/apis/kubebind/v1alpha1/clusterbinding_types.go +++ b/sdk/apis/kubebind/v1alpha1/clusterbinding_types.go @@ -34,8 +34,8 @@ const ( ClusterBindingConditionHealthy = "Healthy" ) -// ClusterBinding represents a bound consumer cluster. It lives in a service -// provider cluster and is a singleton named "cluster" per namespace. +// ClusterBinding represents a bound consumer cluster. It lives in a service provider cluster +// and is a singleton named "cluster". // // +crd // +genclient