Skip to content

Commit c9339f1

Browse files
committed
address reviews
1 parent 1598aea commit c9339f1

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

backend/provider/kcp/controllers/apibindingtemplate/reconcile.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ import (
3737
)
3838

3939
// templateNameForBinding derives a deterministic APIServiceExportTemplate name
40-
// from the APIBinding name and scope.
40+
// from the APIBinding name and scope. The naming convention is:
41+
//
42+
// <bindingName>-cluster for ClusterScope
43+
// <bindingName>-namespaced for NamespacedScope
44+
//
45+
// Note: if a binding name already ends in "-cluster" or "-namespaced", this
46+
// could theoretically collide with another binding's template name. In practice
47+
// kcp APIBinding names are generated and unlikely to hit this edge case.
4148
func templateNameForBinding(bindingName string, scope kubebindv1alpha2.InformerScope) string {
4249
switch scope {
4350
case kubebindv1alpha2.ClusterScope:

backend/provider/kcp/controllers/shared/vw.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ import (
3737
const AnnotationOwnerBinding = "apibindingtemplate.kube-bind.io/owner-binding"
3838

3939
// ExtractClusterID extracts the cluster ID from an apiexport virtual workspace
40-
// URL. The URL format is:
41-
// https://host:port/services/apiexport/root:org:ws/<apiexport-name>/clusters/{cluster-id}
40+
// URL. The expected URL format (as of kcp v0.26+) is:
41+
//
42+
// https://host:port/services/apiexport/<path>/<apiexport-name>/clusters/<cluster-id>
43+
//
44+
// where path segments 0-3 are /services/apiexport/<workspace-path>/<export>,
45+
// segment 4 is "clusters", and segment 5 is the cluster ID.
4246
func ExtractClusterID(clusterConfig *rest.Config) (string, error) {
4347
u, err := url.Parse(clusterConfig.Host)
4448
if err != nil {

contrib/kcp/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ The provider workspace owns the `cowboys` `APIResourceSchema` and `APIExport`.
5757

5858
2. Set up the provider workspace:
5959

60-
cp ../../kcp-dev/kcp/.kcp/admin.kubeconfig .kcp/admin.kubeconfig
6160

6261
```bash
6362
cp .kcp/admin.kubeconfig .kcp/provider.kubeconfig

0 commit comments

Comments
 (0)