Skip to content

Commit c68176a

Browse files
committed
Do not set the owner annotation on LogicalClusters to empty value
On-behalf-of: SAP <[email protected]> Signed-off-by: Marvin Beckers <[email protected]>
1 parent 68596e1 commit c68176a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pkg/reconciler/tenancy/logicalcluster/logicalcluster_controller.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,11 @@ func (c *Controller) process(ctx context.Context, key string) error {
201201
return nil
202202
}
203203

204-
// need to create
205-
ownerAnnotation, found := logicalCluster.Annotations[tenancyv1alpha1.ExperimentalWorkspaceOwnerAnnotationKey]
206-
if !found {
204+
// need to create ClusterRoleBinding for owner.
205+
ownerAnnotation := logicalCluster.Annotations[tenancyv1alpha1.ExperimentalWorkspaceOwnerAnnotationKey]
206+
// some older installations of kcp might have produced an annotation with empty value, so we should
207+
// not care whether the annotation is set or if it's empty.
208+
if ownerAnnotation == "" {
207209
// no owner - can't create
208210
return nil
209211
}

pkg/reconciler/tenancy/workspace/workspace_reconcile_scheduling.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,8 @@ func (r *schedulingReconciler) createLogicalCluster(ctx context.Context, shard *
247247
ObjectMeta: metav1.ObjectMeta{
248248
Name: corev1alpha1.LogicalClusterName,
249249
Annotations: map[string]string{
250-
tenancyv1alpha1.ExperimentalWorkspaceOwnerAnnotationKey: workspace.Annotations[tenancyv1alpha1.ExperimentalWorkspaceOwnerAnnotationKey],
251-
tenancyv1alpha1.LogicalClusterTypeAnnotationKey: logicalcluster.NewPath(workspace.Spec.Type.Path).Join(string(workspace.Spec.Type.Name)).String(),
252-
core.LogicalClusterPathAnnotationKey: canonicalPath.String(),
250+
tenancyv1alpha1.LogicalClusterTypeAnnotationKey: logicalcluster.NewPath(workspace.Spec.Type.Path).Join(string(workspace.Spec.Type.Name)).String(),
251+
core.LogicalClusterPathAnnotationKey: canonicalPath.String(),
253252
},
254253
},
255254
Spec: corev1alpha1.LogicalClusterSpec{

0 commit comments

Comments
 (0)