Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit eb89331

Browse files
chess-knightmatofeder
authored andcommitted
Ensure that cloud name MinLength is 1
Signed-off-by: Roman Hros <[email protected]>
1 parent 3318740 commit eb89331

6 files changed

+11
-8
lines changed

api/v1alpha1/openstackclusterstackrelease_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
// OpenStackClusterStackReleaseSpec defines the desired state of OpenStackClusterStackRelease.
2929
type OpenStackClusterStackReleaseSpec struct {
3030
// CloudName is the name of the cloud to use from the cloud's secret.
31+
// +kubebuilder:validation:MinLength=1
3132
CloudName string `json:"cloudName"`
3233
// IdentityRef is a reference to a identity to be used when reconciling this cluster
3334
IdentityRef *apiv1alpha7.OpenStackIdentityReference `json:"identityRef"`

api/v1alpha1/openstacknodeimagerelease_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
// OpenStackNodeImageReleaseSpec defines the desired state of OpenStackNodeImageRelease.
3030
type OpenStackNodeImageReleaseSpec struct {
3131
// CloudName is the name of the cloud to use from the cloud's secret.
32+
// +kubebuilder:validation:MinLength=1
3233
CloudName string `json:"cloudName"`
3334
// IdentityRef is a reference to a identity to be used when reconciling this cluster
3435
IdentityRef *apiv1alpha7.OpenStackIdentityReference `json:"identityRef"`

config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleases.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ spec:
5353
of OpenStackClusterStackRelease.
5454
properties:
5555
cloudName:
56-
description: The name of the cloud to use from the clouds secret
56+
description: CloudName is the name of the cloud to use from the cloud's
57+
secret.
58+
minLength: 1
5759
type: string
5860
identityRef:
5961
description: IdentityRef is a reference to a identity to be used when

config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleasetemplates.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ spec:
4848
state of OpenStackClusterStackRelease.
4949
properties:
5050
cloudName:
51-
description: The name of the cloud to use from the clouds
52-
secret
51+
description: CloudName is the name of the cloud to use from
52+
the cloud's secret.
53+
minLength: 1
5354
type: string
5455
identityRef:
5556
description: IdentityRef is a reference to a identity to be

config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstacknodeimagereleases.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ spec:
5353
OpenStackNodeImageRelease.
5454
properties:
5555
cloudName:
56-
description: The name of the cloud to use from the clouds secret
56+
description: CloudName is the name of the cloud to use from the cloud's
57+
secret.
58+
minLength: 1
5759
type: string
5860
identityRef:
5961
description: IdentityRef is a reference to a identity to be used when

internal/controller/openstacknodeimagerelease_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ func (r *OpenStackNodeImageReleaseReconciler) getCloudFromSecret(ctx context.Con
266266
var clouds clientconfig.Clouds
267267
emptyCloud := clientconfig.Cloud{}
268268

269-
if cloudName == "" {
270-
return emptyCloud, fmt.Errorf("secret name set to %s but no cloud was specified. Please set cloud_name in your machine spec", secretName)
271-
}
272-
273269
secret := &corev1.Secret{}
274270
err := r.Get(ctx, types.NamespacedName{
275271
Namespace: secretNamespace,

0 commit comments

Comments
 (0)