Skip to content

Commit 9dbe5a1

Browse files
committed
rename to cluster because it's more generic
On-behalf-of: @SAP [email protected]
1 parent c549035 commit 9dbe5a1

File tree

6 files changed

+97
-16
lines changed

6 files changed

+97
-16
lines changed

config/crd/bases/operator.kcp.io_kubeconfigs.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ spec:
4545
properties:
4646
clusterRoleBindings:
4747
properties:
48+
cluster:
49+
description: Cluster can be either a cluster name or a workspace
50+
path.
51+
type: string
4852
clusterRoles:
4953
items:
5054
type: string
5155
type: array
52-
workspacePath:
53-
type: string
5456
required:
57+
- cluster
5558
- clusterRoles
56-
- workspacePath
5759
type: object
5860
required:
5961
- clusterRoleBindings
@@ -361,10 +363,10 @@ spec:
361363
properties:
362364
authorization:
363365
properties:
364-
provisionedWorkspace:
366+
provisionedCluster:
365367
type: string
366368
required:
367-
- provisionedWorkspace
369+
- provisionedCluster
368370
type: object
369371
type: object
370372
type: object

internal/controller/kubeconfig-rbac/controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (r *KubeconfigRBACReconciler) reconcile(ctx context.Context, config *operat
114114
}
115115

116116
func (r *KubeconfigRBACReconciler) reconcileBindings(ctx context.Context, kc *operatorv1alpha1.Kubeconfig) error {
117-
targetClient, err := client.NewInternalKubeconfigClient(ctx, r.Client, kc, logicalcluster.Name(kc.Spec.Authorization.ClusterRoleBindings.WorkspacePath), nil)
117+
targetClient, err := client.NewInternalKubeconfigClient(ctx, r.Client, kc, logicalcluster.Name(kc.Spec.Authorization.ClusterRoleBindings.Cluster), nil)
118118
if err != nil {
119119
return fmt.Errorf("failed to create client to kubeconfig target: %w", err)
120120
}
@@ -171,7 +171,7 @@ func (r *KubeconfigRBACReconciler) handleDeletion(ctx context.Context, kc *opera
171171
return nil
172172
}
173173

174-
targetClient, err := client.NewInternalKubeconfigClient(ctx, r.Client, kc, logicalcluster.Name(kc.Spec.Authorization.ClusterRoleBindings.WorkspacePath), nil)
174+
targetClient, err := client.NewInternalKubeconfigClient(ctx, r.Client, kc, logicalcluster.Name(kc.Spec.Authorization.ClusterRoleBindings.Cluster), nil)
175175
if err != nil {
176176
return fmt.Errorf("failed to create client to kubeconfig target: %w", err)
177177
}

sdk/apis/operator/v1alpha1/kubeconfig_types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ type KubeconfigAuthorization struct {
5858
}
5959

6060
type KubeconfigClusterRoleBindings struct {
61-
WorkspacePath string `json:"workspacePath"`
62-
ClusterRoles []string `json:"clusterRoles"`
61+
// Cluster can be either a cluster name or a workspace path.
62+
Cluster string `json:"cluster"`
63+
ClusterRoles []string `json:"clusterRoles"`
6364
}
6465

6566
// KubeconfigStatus defines the observed state of Kubeconfig
@@ -68,7 +69,7 @@ type KubeconfigStatus struct {
6869
}
6970

7071
type KubeconfigAuthorizationStatus struct {
71-
ProvisionedWorkspace string `json:"provisionedWorkspace"`
72+
ProvisionedCluster string `json:"provisionedCluster"`
7273
}
7374

7475
// +genclient

sdk/applyconfiguration/operator/v1alpha1/kubeconfigauthorizationstatus.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/applyconfiguration/operator/v1alpha1/kubeconfigclusterrolebindings.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/applyconfiguration/operator/v1alpha1/kubeconfigstatus.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)