Skip to content

Commit ae3be39

Browse files
ValentinGerlachreshnm
authored andcommitted
allow override of kind cluster name
1 parent 2a2c2de commit ae3be39

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/controller/cluster_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
clustersv1alpha1 "github.com/openmcp-project/openmcp-operator/api/clusters/v1alpha1"
3535
commonapi "github.com/openmcp-project/openmcp-operator/api/common"
3636

37+
"github.com/openmcp-project/cluster-provider-kind/api/v1alpha1"
3738
"github.com/openmcp-project/cluster-provider-kind/pkg/kind"
3839
"github.com/openmcp-project/cluster-provider-kind/pkg/metallb"
3940
"github.com/openmcp-project/cluster-provider-kind/pkg/smartrequeue"
@@ -42,6 +43,9 @@ import (
4243
var (
4344
// Finalizer is the finalizer for Cluster
4445
Finalizer = clustersv1alpha1.GroupVersion.Group + "/finalizer"
46+
47+
// AnnotationName can be used to override the name of the kind cluster.
48+
AnnotationName = v1alpha1.GroupVersion.Group + "/name"
4549
)
4650

4751
const (
@@ -227,6 +231,9 @@ func (r *ClusterReconciler) assignSubnet(ctx context.Context, cluster *clustersv
227231
}
228232

229233
func kindName(cluster *clustersv1alpha1.Cluster) string {
234+
if name, ok := cluster.Annotations[AnnotationName]; ok {
235+
return name
236+
}
230237
return fmt.Sprintf("%s.%s", cluster.Name, string(cluster.UID)[:8])
231238
}
232239

0 commit comments

Comments
 (0)