diff --git a/docs/book/src/developer/providers/contracts/control-plane.md b/docs/book/src/developer/providers/contracts/control-plane.md
index c9c503344116..c2832c56a725 100644
--- a/docs/book/src/developer/providers/contracts/control-plane.md
+++ b/docs/book/src/developer/providers/contracts/control-plane.md
@@ -237,19 +237,26 @@ in the ControlPlane resource.
type FooControlPlaneSpec struct {
// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
- ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint"`
+ ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint,omitempty,omitzero"`
// See other rules for more details about mandatory/optional fields in ControlPlane spec.
// Other fields SHOULD be added based on the needs of your provider.
}
// APIEndpoint represents a reachable Kubernetes API endpoint.
+// +kubebuilder:validation:MinProperties=1
type APIEndpoint struct {
// host is the hostname on which the API server is serving.
- Host string `json:"host"`
-
+ // +optional
+ // +kubebuilder:validation:MinLength=1
+ // +kubebuilder:validation:MaxLength=512
+ Host string `json:"host,omitempty"`
+
// port is the port on which the API server is serving.
- Port int32 `json:"port"`
+ // +optional
+ // +kubebuilder:validation:Minimum=1
+ // +kubebuilder:validation:Maximum=65535
+ Port int32 `json:"port,omitempty"`
}
```
@@ -259,6 +266,35 @@ the Cluster controller will surface this info in Cluster's `spec.controlPlaneEnd
If instead you are developing a control plane provider which is NOT responsible to provide a control plane endpoint,
the implementer should exit reconciliation until it sees Cluster's `spec.controlPlaneEndpoint` populated.
+
+
### ControlPlane: replicas
In case you are developing a control plane provider which allows control of the number of replicas of the
diff --git a/docs/book/src/developer/providers/contracts/infra-cluster.md b/docs/book/src/developer/providers/contracts/infra-cluster.md
index 1d30c8b97a32..c8647c375d49 100644
--- a/docs/book/src/developer/providers/contracts/infra-cluster.md
+++ b/docs/book/src/developer/providers/contracts/infra-cluster.md
@@ -221,19 +221,26 @@ in the InfraCluster resource.
type FooClusterSpec struct {
// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
- ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint"`
+ ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint,omitempty,omitzero"`
// See other rules for more details about mandatory/optional fields in InfraCluster spec.
// Other fields SHOULD be added based on the needs of your provider.
}
// APIEndpoint represents a reachable Kubernetes API endpoint.
+// +kubebuilder:validation:MinProperties=1
type APIEndpoint struct {
// host is the hostname on which the API server is serving.
- Host string `json:"host"`
-
+ // +optional
+ // +kubebuilder:validation:MinLength=1
+ // +kubebuilder:validation:MaxLength=512
+ Host string `json:"host,omitempty"`
+
// port is the port on which the API server is serving.
- Port int32 `json:"port"`
+ // +optional
+ // +kubebuilder:validation:Minimum=1
+ // +kubebuilder:validation:Maximum=65535
+ Port int32 `json:"port,omitempty"`
}
```
@@ -243,6 +250,35 @@ the Cluster controller will surface this info in Cluster's `spec.controlPlaneEnd
If instead you are developing an infrastructure provider which is NOT responsible to provide a control plane endpoint,
the implementer should exit reconciliation until it sees Cluster's `spec.controlPlaneEndpoint` populated.
+
+
### InfraCluster: failure domains
In case you are developing an infrastructure provider which has a notion of failure domains where machines should be
diff --git a/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md b/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md
index 5fea4c80a3be..38fbcb0b8bdd 100644
--- a/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md
+++ b/docs/book/src/developer/providers/migrations/v1.10-to-v1.11.md
@@ -437,6 +437,7 @@ KubeadmControlPlaneTemplate `spec.template.spec` has been aligned to changes in
Following rules have been changed or are not supported anymore; please read corresponding notes about compatibility
for providers still implementing the v1beta1 contract.
+- [InfraCluster: control plane endpoint](../contracts/infra-cluster.md#infracluster-control-plane-endpoint)
- [InfraCluster: failure domains](../contracts/infra-cluster.md#infracluster-failure-domains)
- [InfraCluster: initialization completed](../contracts/infra-cluster.md#infracluster-initialization-completed)
- [InfraCluster: conditions](../contracts/infra-cluster.md#infracluster-conditions)
@@ -488,6 +489,7 @@ for providers still implementing the v1beta1 contract.
Following rules have been changed or are not supported anymore; please read corresponding notes about compatibility
for providers still implementing the v1beta1 contract.
+- [ControlPlane: control plane endpoint](../contracts/control-plane.md#controlplane-endpoint)
- [ControlPlane: machines](../contracts/control-plane.md#controlplane-machines)
- [ControlPlane: initialization completed](../contracts/control-plane.md#controlplane-initialization-completed)
- [ControlPlane: replicas](../contracts/control-plane.md#controlplane-replicas)
diff --git a/test/infrastructure/docker/api/v1alpha3/conversion.go b/test/infrastructure/docker/api/v1alpha3/conversion.go
index b78b43b7303f..439a4cb20931 100644
--- a/test/infrastructure/docker/api/v1alpha3/conversion.go
+++ b/test/infrastructure/docker/api/v1alpha3/conversion.go
@@ -108,6 +108,10 @@ func (dst *DockerMachine) ConvertFrom(srcRaw conversion.Hub) error {
return err
}
+ if dst.Spec.ProviderID != nil && *dst.Spec.ProviderID == "" {
+ dst.Spec.ProviderID = nil
+ }
+
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
}
@@ -141,6 +145,10 @@ func (dst *DockerMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
return err
}
+ if dst.Spec.Template.Spec.ProviderID != nil && *dst.Spec.Template.Spec.ProviderID == "" {
+ dst.Spec.Template.Spec.ProviderID = nil
+ }
+
// Preserve Hub data on down-conversion except for metadata
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
diff --git a/test/infrastructure/docker/api/v1alpha3/conversion_test.go b/test/infrastructure/docker/api/v1alpha3/conversion_test.go
index 6357c2192a96..5b94e9bff9a7 100644
--- a/test/infrastructure/docker/api/v1alpha3/conversion_test.go
+++ b/test/infrastructure/docker/api/v1alpha3/conversion_test.go
@@ -48,8 +48,9 @@ func TestFuzzyConversion(t *testing.T) {
}))
t.Run("for DockerMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
- Hub: &infrav1.DockerMachineTemplate{},
- Spoke: &DockerMachineTemplate{},
+ Hub: &infrav1.DockerMachineTemplate{},
+ Spoke: &DockerMachineTemplate{},
+ FuzzerFuncs: []fuzzer.FuzzerFuncs{DockerMachineTemplateFuzzFunc},
}))
}
@@ -87,6 +88,7 @@ func hubFailureDomain(in *clusterv1.FailureDomain, c randfill.Continue) {
func DockerMachineFuzzFunc(_ runtimeserializer.CodecFactory) []any {
return []any{
hubDockerMachineStatus,
+ spokeDockerMachineSpec,
}
}
@@ -105,3 +107,17 @@ func hubDockerMachineStatus(in *infrav1.DockerMachineStatus, c randfill.Continue
}
}
}
+
+func spokeDockerMachineSpec(in *DockerMachineSpec, c randfill.Continue) {
+ c.FillNoCustom(in)
+
+ if in.ProviderID != nil && *in.ProviderID == "" {
+ in.ProviderID = nil
+ }
+}
+
+func DockerMachineTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
+ return []any{
+ spokeDockerMachineSpec,
+ }
+}
diff --git a/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go b/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go
index 84fdd20e9184..4782c222967e 100644
--- a/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go
+++ b/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go
@@ -194,7 +194,7 @@ func RegisterConversions(s *runtime.Scheme) error {
func autoConvert_v1alpha3_APIEndpoint_To_v1beta2_APIEndpoint(in *APIEndpoint, out *v1beta2.APIEndpoint, s conversion.Scope) error {
out.Host = in.Host
- out.Port = in.Port
+ out.Port = int32(in.Port)
return nil
}
@@ -205,7 +205,7 @@ func Convert_v1alpha3_APIEndpoint_To_v1beta2_APIEndpoint(in *APIEndpoint, out *v
func autoConvert_v1beta2_APIEndpoint_To_v1alpha3_APIEndpoint(in *v1beta2.APIEndpoint, out *APIEndpoint, s conversion.Scope) error {
out.Host = in.Host
- out.Port = in.Port
+ out.Port = int(in.Port)
return nil
}
@@ -415,7 +415,9 @@ func Convert_v1beta2_DockerMachineList_To_v1alpha3_DockerMachineList(in *v1beta2
}
func autoConvert_v1alpha3_DockerMachineSpec_To_v1beta2_DockerMachineSpec(in *DockerMachineSpec, out *v1beta2.DockerMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_Pointer_string_To_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
out.CustomImage = in.CustomImage
out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages))
out.ExtraMounts = *(*[]v1beta2.Mount)(unsafe.Pointer(&in.ExtraMounts))
@@ -429,7 +431,9 @@ func Convert_v1alpha3_DockerMachineSpec_To_v1beta2_DockerMachineSpec(in *DockerM
}
func autoConvert_v1beta2_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(in *v1beta2.DockerMachineSpec, out *DockerMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_string_To_Pointer_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
out.CustomImage = in.CustomImage
out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages))
out.ExtraMounts = *(*[]Mount)(unsafe.Pointer(&in.ExtraMounts))
diff --git a/test/infrastructure/docker/api/v1alpha4/conversion.go b/test/infrastructure/docker/api/v1alpha4/conversion.go
index 22958ce81524..902c3e98b634 100644
--- a/test/infrastructure/docker/api/v1alpha4/conversion.go
+++ b/test/infrastructure/docker/api/v1alpha4/conversion.go
@@ -136,6 +136,10 @@ func (dst *DockerMachine) ConvertFrom(srcRaw conversion.Hub) error {
return err
}
+ if dst.Spec.ProviderID != nil && *dst.Spec.ProviderID == "" {
+ dst.Spec.ProviderID = nil
+ }
+
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
}
@@ -169,6 +173,10 @@ func (dst *DockerMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
return err
}
+ if dst.Spec.Template.Spec.ProviderID != nil && *dst.Spec.Template.Spec.ProviderID == "" {
+ dst.Spec.Template.Spec.ProviderID = nil
+ }
+
// Preserve Hub data on down-conversion except for metadata
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
diff --git a/test/infrastructure/docker/api/v1alpha4/conversion_test.go b/test/infrastructure/docker/api/v1alpha4/conversion_test.go
index 62d1a31c36f8..a266db85a110 100644
--- a/test/infrastructure/docker/api/v1alpha4/conversion_test.go
+++ b/test/infrastructure/docker/api/v1alpha4/conversion_test.go
@@ -54,8 +54,9 @@ func TestFuzzyConversion(t *testing.T) {
}))
t.Run("for DockerMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
- Hub: &infrav1.DockerMachineTemplate{},
- Spoke: &DockerMachineTemplate{},
+ Hub: &infrav1.DockerMachineTemplate{},
+ Spoke: &DockerMachineTemplate{},
+ FuzzerFuncs: []fuzzer.FuzzerFuncs{DockerMachineTemplateFuzzFunc},
}))
}
@@ -99,6 +100,7 @@ func DockerClusterTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
func DockerMachineFuzzFunc(_ runtimeserializer.CodecFactory) []any {
return []any{
hubDockerMachineStatus,
+ spokeDockerMachineSpec,
}
}
@@ -117,3 +119,17 @@ func hubDockerMachineStatus(in *infrav1.DockerMachineStatus, c randfill.Continue
}
}
}
+
+func spokeDockerMachineSpec(in *DockerMachineSpec, c randfill.Continue) {
+ c.FillNoCustom(in)
+
+ if in.ProviderID != nil && *in.ProviderID == "" {
+ in.ProviderID = nil
+ }
+}
+
+func DockerMachineTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
+ return []any{
+ spokeDockerMachineSpec,
+ }
+}
diff --git a/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go b/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go
index bd8a26beb484..5c66d44f3fab 100644
--- a/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go
+++ b/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go
@@ -254,7 +254,7 @@ func RegisterConversions(s *runtime.Scheme) error {
func autoConvert_v1alpha4_APIEndpoint_To_v1beta2_APIEndpoint(in *APIEndpoint, out *v1beta2.APIEndpoint, s conversion.Scope) error {
out.Host = in.Host
- out.Port = in.Port
+ out.Port = int32(in.Port)
return nil
}
@@ -265,7 +265,7 @@ func Convert_v1alpha4_APIEndpoint_To_v1beta2_APIEndpoint(in *APIEndpoint, out *v
func autoConvert_v1beta2_APIEndpoint_To_v1alpha4_APIEndpoint(in *v1beta2.APIEndpoint, out *APIEndpoint, s conversion.Scope) error {
out.Host = in.Host
- out.Port = in.Port
+ out.Port = int(in.Port)
return nil
}
@@ -597,7 +597,9 @@ func Convert_v1beta2_DockerMachineList_To_v1alpha4_DockerMachineList(in *v1beta2
}
func autoConvert_v1alpha4_DockerMachineSpec_To_v1beta2_DockerMachineSpec(in *DockerMachineSpec, out *v1beta2.DockerMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_Pointer_string_To_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
out.CustomImage = in.CustomImage
out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages))
out.ExtraMounts = *(*[]v1beta2.Mount)(unsafe.Pointer(&in.ExtraMounts))
@@ -611,7 +613,9 @@ func Convert_v1alpha4_DockerMachineSpec_To_v1beta2_DockerMachineSpec(in *DockerM
}
func autoConvert_v1beta2_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in *v1beta2.DockerMachineSpec, out *DockerMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_string_To_Pointer_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
out.CustomImage = in.CustomImage
out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages))
out.ExtraMounts = *(*[]Mount)(unsafe.Pointer(&in.ExtraMounts))
diff --git a/test/infrastructure/docker/api/v1beta1/conversion.go b/test/infrastructure/docker/api/v1beta1/conversion.go
index 598acaf46077..b5261c5304e1 100644
--- a/test/infrastructure/docker/api/v1beta1/conversion.go
+++ b/test/infrastructure/docker/api/v1beta1/conversion.go
@@ -99,6 +99,10 @@ func (dst *DockerMachine) ConvertFrom(srcRaw conversion.Hub) error {
return err
}
+ if dst.Spec.ProviderID != nil && *dst.Spec.ProviderID == "" {
+ dst.Spec.ProviderID = nil
+ }
+
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
}
@@ -115,7 +119,15 @@ func (src *DockerMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
func (dst *DockerMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.DockerMachineTemplate)
- return Convert_v1beta2_DockerMachineTemplate_To_v1beta1_DockerMachineTemplate(src, dst, nil)
+ if err := Convert_v1beta2_DockerMachineTemplate_To_v1beta1_DockerMachineTemplate(src, dst, nil); err != nil {
+ return err
+ }
+
+ if dst.Spec.Template.Spec.ProviderID != nil && *dst.Spec.Template.Spec.ProviderID == "" {
+ dst.Spec.Template.Spec.ProviderID = nil
+ }
+
+ return nil
}
func (src *DevCluster) ConvertTo(dstRaw conversion.Hub) error {
@@ -185,6 +197,10 @@ func (dst *DevMachine) ConvertFrom(srcRaw conversion.Hub) error {
return err
}
+ if dst.Spec.ProviderID != nil && *dst.Spec.ProviderID == "" {
+ dst.Spec.ProviderID = nil
+ }
+
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
}
@@ -201,7 +217,15 @@ func (src *DevMachineTemplate) ConvertTo(dstRaw conversion.Hub) error {
func (dst *DevMachineTemplate) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*infrav1.DevMachineTemplate)
- return Convert_v1beta2_DevMachineTemplate_To_v1beta1_DevMachineTemplate(src, dst, nil)
+ if err := Convert_v1beta2_DevMachineTemplate_To_v1beta1_DevMachineTemplate(src, dst, nil); err != nil {
+ return err
+ }
+
+ if dst.Spec.Template.Spec.ProviderID != nil && *dst.Spec.Template.Spec.ProviderID == "" {
+ dst.Spec.Template.Spec.ProviderID = nil
+ }
+
+ return nil
}
func Convert_v1beta1_ObjectMeta_To_v1beta2_ObjectMeta(in *clusterv1beta1.ObjectMeta, out *clusterv1.ObjectMeta, s apiconversion.Scope) error {
diff --git a/test/infrastructure/docker/api/v1beta1/conversion_test.go b/test/infrastructure/docker/api/v1beta1/conversion_test.go
index 6f2c79a2dc59..9e1ee7ed0071 100644
--- a/test/infrastructure/docker/api/v1beta1/conversion_test.go
+++ b/test/infrastructure/docker/api/v1beta1/conversion_test.go
@@ -54,8 +54,9 @@ func TestFuzzyConversion(t *testing.T) {
}))
t.Run("for DockerMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
- Hub: &infrav1.DockerMachineTemplate{},
- Spoke: &DockerMachineTemplate{},
+ Hub: &infrav1.DockerMachineTemplate{},
+ Spoke: &DockerMachineTemplate{},
+ FuzzerFuncs: []fuzzer.FuzzerFuncs{DockerMachineTemplateFuzzFunc},
}))
t.Run("for DevCluster", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
@@ -77,8 +78,9 @@ func TestFuzzyConversion(t *testing.T) {
}))
t.Run("for DevMachineTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{
- Hub: &infrav1.DevMachineTemplate{},
- Spoke: &DevMachineTemplate{},
+ Hub: &infrav1.DevMachineTemplate{},
+ Spoke: &DevMachineTemplate{},
+ FuzzerFuncs: []fuzzer.FuzzerFuncs{DevMachineTemplateFuzzFunc},
}))
}
@@ -134,6 +136,7 @@ func DockerClusterTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
func DockerMachineFuzzFunc(_ runtimeserializer.CodecFactory) []any {
return []any{
hubDockerMachineStatus,
+ spokeDockerMachineSpec,
spokeDockerMachineStatus,
}
}
@@ -154,6 +157,14 @@ func hubDockerMachineStatus(in *infrav1.DockerMachineStatus, c randfill.Continue
}
}
+func spokeDockerMachineSpec(in *DockerMachineSpec, c randfill.Continue) {
+ c.FillNoCustom(in)
+
+ if in.ProviderID != nil && *in.ProviderID == "" {
+ in.ProviderID = nil
+ }
+}
+
func spokeDockerMachineStatus(in *DockerMachineStatus, c randfill.Continue) {
c.FillNoCustom(in)
@@ -165,6 +176,12 @@ func spokeDockerMachineStatus(in *DockerMachineStatus, c randfill.Continue) {
}
}
+func DockerMachineTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
+ return []any{
+ spokeDockerMachineSpec,
+ }
+}
+
func DevClusterFuzzFunc(_ runtimeserializer.CodecFactory) []any {
return []any{
hubDevClusterStatus,
@@ -209,6 +226,7 @@ func DevClusterTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
func DevMachineFuzzFunc(_ runtimeserializer.CodecFactory) []any {
return []any{
hubDevMachineStatus,
+ spokeDevMachineSpec,
spokeDevMachineStatus,
}
}
@@ -229,6 +247,14 @@ func hubDevMachineStatus(in *infrav1.DevMachineStatus, c randfill.Continue) {
}
}
+func spokeDevMachineSpec(in *DevMachineSpec, c randfill.Continue) {
+ c.FillNoCustom(in)
+
+ if in.ProviderID != nil && *in.ProviderID == "" {
+ in.ProviderID = nil
+ }
+}
+
func spokeDevMachineStatus(in *DevMachineStatus, c randfill.Continue) {
c.FillNoCustom(in)
@@ -239,3 +265,9 @@ func spokeDevMachineStatus(in *DevMachineStatus, c randfill.Continue) {
}
}
}
+
+func DevMachineTemplateFuzzFunc(_ runtimeserializer.CodecFactory) []any {
+ return []any{
+ spokeDevMachineSpec,
+ }
+}
diff --git a/test/infrastructure/docker/api/v1beta1/zz_generated.conversion.go b/test/infrastructure/docker/api/v1beta1/zz_generated.conversion.go
index a35e9787b3be..8300204cdc06 100644
--- a/test/infrastructure/docker/api/v1beta1/zz_generated.conversion.go
+++ b/test/infrastructure/docker/api/v1beta1/zz_generated.conversion.go
@@ -555,7 +555,7 @@ func RegisterConversions(s *runtime.Scheme) error {
func autoConvert_v1beta1_APIEndpoint_To_v1beta2_APIEndpoint(in *APIEndpoint, out *v1beta2.APIEndpoint, s conversion.Scope) error {
out.Host = in.Host
- out.Port = in.Port
+ out.Port = int32(in.Port)
return nil
}
@@ -566,7 +566,7 @@ func Convert_v1beta1_APIEndpoint_To_v1beta2_APIEndpoint(in *APIEndpoint, out *v1
func autoConvert_v1beta2_APIEndpoint_To_v1beta1_APIEndpoint(in *v1beta2.APIEndpoint, out *APIEndpoint, s conversion.Scope) error {
out.Host = in.Host
- out.Port = in.Port
+ out.Port = int(in.Port)
return nil
}
@@ -1014,7 +1014,9 @@ func Convert_v1beta2_DevMachineList_To_v1beta1_DevMachineList(in *v1beta2.DevMac
}
func autoConvert_v1beta1_DevMachineSpec_To_v1beta2_DevMachineSpec(in *DevMachineSpec, out *v1beta2.DevMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_Pointer_string_To_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
if err := Convert_v1beta1_DevMachineBackendSpec_To_v1beta2_DevMachineBackendSpec(&in.Backend, &out.Backend, s); err != nil {
return err
}
@@ -1027,7 +1029,9 @@ func Convert_v1beta1_DevMachineSpec_To_v1beta2_DevMachineSpec(in *DevMachineSpec
}
func autoConvert_v1beta2_DevMachineSpec_To_v1beta1_DevMachineSpec(in *v1beta2.DevMachineSpec, out *DevMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_string_To_Pointer_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
if err := Convert_v1beta2_DevMachineBackendSpec_To_v1beta1_DevMachineBackendSpec(&in.Backend, &out.Backend, s); err != nil {
return err
}
@@ -1618,7 +1622,9 @@ func Convert_v1beta2_DockerMachineList_To_v1beta1_DockerMachineList(in *v1beta2.
}
func autoConvert_v1beta1_DockerMachineSpec_To_v1beta2_DockerMachineSpec(in *DockerMachineSpec, out *v1beta2.DockerMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_Pointer_string_To_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
out.CustomImage = in.CustomImage
out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages))
out.ExtraMounts = *(*[]v1beta2.Mount)(unsafe.Pointer(&in.ExtraMounts))
@@ -1633,7 +1639,9 @@ func Convert_v1beta1_DockerMachineSpec_To_v1beta2_DockerMachineSpec(in *DockerMa
}
func autoConvert_v1beta2_DockerMachineSpec_To_v1beta1_DockerMachineSpec(in *v1beta2.DockerMachineSpec, out *DockerMachineSpec, s conversion.Scope) error {
- out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID))
+ if err := v1.Convert_string_To_Pointer_string(&in.ProviderID, &out.ProviderID, s); err != nil {
+ return err
+ }
out.CustomImage = in.CustomImage
out.PreLoadImages = *(*[]string)(unsafe.Pointer(&in.PreLoadImages))
out.ExtraMounts = *(*[]Mount)(unsafe.Pointer(&in.ExtraMounts))
diff --git a/test/infrastructure/docker/api/v1beta2/devcluster_types.go b/test/infrastructure/docker/api/v1beta2/devcluster_types.go
index 474962c15f98..c7502176f802 100644
--- a/test/infrastructure/docker/api/v1beta2/devcluster_types.go
+++ b/test/infrastructure/docker/api/v1beta2/devcluster_types.go
@@ -72,7 +72,7 @@ const (
type DevClusterSpec struct {
// controlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
- ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint"`
+ ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint,omitempty,omitzero"`
// backend defines backends for a DevCluster.
// +required
diff --git a/test/infrastructure/docker/api/v1beta2/devmachine_types.go b/test/infrastructure/docker/api/v1beta2/devmachine_types.go
index a186cb9c4a6f..65be521ed97b 100644
--- a/test/infrastructure/docker/api/v1beta2/devmachine_types.go
+++ b/test/infrastructure/docker/api/v1beta2/devmachine_types.go
@@ -243,7 +243,9 @@ const (
type DevMachineSpec struct {
// providerID used to link this machine with the node hosted on it.
// +optional
- ProviderID *string `json:"providerID,omitempty"`
+ // +kubebuilder:validation:MinLength=1
+ // +kubebuilder:validation:MaxLength=512
+ ProviderID string `json:"providerID,omitempty"`
// backend defines backends for a DevMachine.
// +required
diff --git a/test/infrastructure/docker/api/v1beta2/dockercluster_types.go b/test/infrastructure/docker/api/v1beta2/dockercluster_types.go
index 34d9f60a1c4f..0f8b0ce45677 100644
--- a/test/infrastructure/docker/api/v1beta2/dockercluster_types.go
+++ b/test/infrastructure/docker/api/v1beta2/dockercluster_types.go
@@ -36,7 +36,7 @@ type DockerClusterSpec struct {
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
- ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint"`
+ ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint,omitempty,omitzero"`
// FailureDomains are usually not defined in the spec.
// The docker provider is special since failure domains don't mean anything in a local docker environment.
@@ -143,13 +143,19 @@ type DockerClusterV1Beta1DeprecatedStatus struct {
}
// APIEndpoint represents a reachable Kubernetes API endpoint.
+// +kubebuilder:validation:MinProperties=1
type APIEndpoint struct {
- // Host is the hostname on which the API server is serving.
- Host string `json:"host"`
+ // host is the hostname on which the API server is serving.
+ // +optional
+ // +kubebuilder:validation:MinLength=1
+ // +kubebuilder:validation:MaxLength=512
+ Host string `json:"host,omitempty"`
- // Port is the port on which the API server is serving.
- // Defaults to 6443 if not set.
- Port int `json:"port"`
+ // port is the port on which the API server is serving.
+ // +optional
+ // +kubebuilder:validation:Minimum=1
+ // +kubebuilder:validation:Maximum=65535
+ Port int32 `json:"port,omitempty"`
}
// +kubebuilder:resource:path=dockerclusters,scope=Namespaced,categories=cluster-api
diff --git a/test/infrastructure/docker/api/v1beta2/dockermachine_types.go b/test/infrastructure/docker/api/v1beta2/dockermachine_types.go
index 362727149d21..c94eca334420 100644
--- a/test/infrastructure/docker/api/v1beta2/dockermachine_types.go
+++ b/test/infrastructure/docker/api/v1beta2/dockermachine_types.go
@@ -32,7 +32,9 @@ const (
type DockerMachineSpec struct {
// ProviderID will be the container name in ProviderID format (docker:////)
// +optional
- ProviderID *string `json:"providerID,omitempty"`
+ // +kubebuilder:validation:MinLength=1
+ // +kubebuilder:validation:MaxLength=512
+ ProviderID string `json:"providerID,omitempty"`
// CustomImage allows customizing the container image that is used for
// running the machine
diff --git a/test/infrastructure/docker/api/v1beta2/zz_generated.deepcopy.go b/test/infrastructure/docker/api/v1beta2/zz_generated.deepcopy.go
index 46b800586222..1517cbc1f45f 100644
--- a/test/infrastructure/docker/api/v1beta2/zz_generated.deepcopy.go
+++ b/test/infrastructure/docker/api/v1beta2/zz_generated.deepcopy.go
@@ -498,11 +498,6 @@ func (in *DevMachineList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DevMachineSpec) DeepCopyInto(out *DevMachineSpec) {
*out = *in
- if in.ProviderID != nil {
- in, out := &in.ProviderID, &out.ProviderID
- *out = new(string)
- **out = **in
- }
in.Backend.DeepCopyInto(&out.Backend)
}
@@ -1137,11 +1132,6 @@ func (in *DockerMachineList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DockerMachineSpec) DeepCopyInto(out *DockerMachineSpec) {
*out = *in
- if in.ProviderID != nil {
- in, out := &in.ProviderID, &out.ProviderID
- *out = new(string)
- **out = **in
- }
if in.PreLoadImages != nil {
in, out := &in.PreLoadImages, &out.PreLoadImages
*out = make([]string, len(*in))
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclusters.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclusters.yaml
index 0f6e8e1fb056..fc2b3f054494 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclusters.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclusters.yaml
@@ -421,18 +421,19 @@ spec:
controlPlaneEndpoint:
description: controlPlaneEndpoint represents the endpoint used to
communicate with the control plane.
+ minProperties: 1
properties:
host:
- description: Host is the hostname on which the API server is serving.
+ description: host is the hostname on which the API server is serving.
+ maxLength: 512
+ minLength: 1
type: string
port:
- description: |-
- Port is the port on which the API server is serving.
- Defaults to 6443 if not set.
+ description: port is the port on which the API server is serving.
+ format: int32
+ maximum: 65535
+ minimum: 1
type: integer
- required:
- - host
- - port
type: object
required:
- backend
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclustertemplates.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclustertemplates.yaml
index 0a15f1e9c3c0..2eac92c1bfdf 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclustertemplates.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devclustertemplates.yaml
@@ -338,19 +338,21 @@ spec:
controlPlaneEndpoint:
description: controlPlaneEndpoint represents the endpoint
used to communicate with the control plane.
+ minProperties: 1
properties:
host:
- description: Host is the hostname on which the API server
+ description: host is the hostname on which the API server
is serving.
+ maxLength: 512
+ minLength: 1
type: string
port:
- description: |-
- Port is the port on which the API server is serving.
- Defaults to 6443 if not set.
+ description: port is the port on which the API server
+ is serving.
+ format: int32
+ maximum: 65535
+ minimum: 1
type: integer
- required:
- - host
- - port
type: object
required:
- backend
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachines.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachines.yaml
index 5e6bfab6eaa2..ee2399f20302 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachines.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachines.yaml
@@ -600,6 +600,8 @@ spec:
providerID:
description: providerID used to link this machine with the node hosted
on it.
+ maxLength: 512
+ minLength: 1
type: string
required:
- backend
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachinetemplates.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachinetemplates.yaml
index 8729ca7fe695..98a5eb6169fe 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachinetemplates.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_devmachinetemplates.yaml
@@ -472,6 +472,8 @@ spec:
providerID:
description: providerID used to link this machine with the
node hosted on it.
+ maxLength: 512
+ minLength: 1
type: string
required:
- backend
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml
index f193cdc59c67..097ddd28f824 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml
@@ -634,18 +634,19 @@ spec:
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint used to
communicate with the control plane.
+ minProperties: 1
properties:
host:
- description: Host is the hostname on which the API server is serving.
+ description: host is the hostname on which the API server is serving.
+ maxLength: 512
+ minLength: 1
type: string
port:
- description: |-
- Port is the port on which the API server is serving.
- Defaults to 6443 if not set.
+ description: port is the port on which the API server is serving.
+ format: int32
+ maximum: 65535
+ minimum: 1
type: integer
- required:
- - host
- - port
type: object
failureDomains:
description: |-
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclustertemplates.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclustertemplates.yaml
index 4507e72ec59f..9a441939e328 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclustertemplates.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclustertemplates.yaml
@@ -339,19 +339,21 @@ spec:
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint
used to communicate with the control plane.
+ minProperties: 1
properties:
host:
- description: Host is the hostname on which the API server
+ description: host is the hostname on which the API server
is serving.
+ maxLength: 512
+ minLength: 1
type: string
port:
- description: |-
- Port is the port on which the API server is serving.
- Defaults to 6443 if not set.
+ description: port is the port on which the API server
+ is serving.
+ format: int32
+ maximum: 65535
+ minimum: 1
type: integer
- required:
- - host
- - port
type: object
failureDomains:
description: |-
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml
index ae5ae4af9190..b3984280534b 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml
@@ -694,6 +694,8 @@ spec:
providerID:
description: ProviderID will be the container name in ProviderID format
(docker:////)
+ maxLength: 512
+ minLength: 1
type: string
type: object
status:
diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml
index 4adb7d83d384..a9881c0429cf 100644
--- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml
+++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachinetemplates.yaml
@@ -446,6 +446,8 @@ spec:
providerID:
description: ProviderID will be the container name in ProviderID
format (docker:////)
+ maxLength: 512
+ minLength: 1
type: string
type: object
required:
diff --git a/test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go b/test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go
index cf5766e2c581..f84e0b7ec1ab 100644
--- a/test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go
+++ b/test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go
@@ -297,8 +297,8 @@ func (r *DockerMachinePoolReconciler) reconcileNormal(ctx context.Context, clust
// Derive providerIDList from the provider ID on each DockerMachine if it exists. The providerID is set by the DockerMachine controller.
dockerMachinePool.Spec.ProviderIDList = []string{}
for _, dockerMachine := range dockerMachineList.Items {
- if dockerMachine.Spec.ProviderID != nil {
- dockerMachinePool.Spec.ProviderIDList = append(dockerMachinePool.Spec.ProviderIDList, *dockerMachine.Spec.ProviderID)
+ if dockerMachine.Spec.ProviderID != "" {
+ dockerMachinePool.Spec.ProviderIDList = append(dockerMachinePool.Spec.ProviderIDList, dockerMachine.Spec.ProviderID)
}
}
// Ensure the providerIDList is deterministic (getDockerMachines doesn't guarantee a specific order)
diff --git a/test/infrastructure/docker/internal/controllers/backends/docker/dockercluster_backend.go b/test/infrastructure/docker/internal/controllers/backends/docker/dockercluster_backend.go
index 61a77e0985d8..1b7202e55ebf 100644
--- a/test/infrastructure/docker/internal/controllers/backends/docker/dockercluster_backend.go
+++ b/test/infrastructure/docker/internal/controllers/backends/docker/dockercluster_backend.go
@@ -60,7 +60,7 @@ func (r *ClusterBackEndReconciler) ReconcileNormal(ctx context.Context, cluster
externalLoadBalancer, err := docker.NewLoadBalancer(ctx, cluster,
dockerCluster.Spec.Backend.Docker.LoadBalancer.ImageRepository,
dockerCluster.Spec.Backend.Docker.LoadBalancer.ImageTag,
- strconv.Itoa(dockerCluster.Spec.ControlPlaneEndpoint.Port))
+ strconv.Itoa(int(dockerCluster.Spec.ControlPlaneEndpoint.Port)))
if err != nil {
v1beta1conditions.MarkFalse(dockerCluster, infrav1.LoadBalancerAvailableV1Beta1Condition, infrav1.LoadBalancerProvisioningFailedV1Beta1Reason, clusterv1.ConditionSeverityWarning, "%s", err.Error())
conditions.Set(dockerCluster, metav1.Condition{
@@ -127,7 +127,7 @@ func (r *ClusterBackEndReconciler) ReconcileDelete(ctx context.Context, cluster
externalLoadBalancer, err := docker.NewLoadBalancer(ctx, cluster,
dockerCluster.Spec.Backend.Docker.LoadBalancer.ImageRepository,
dockerCluster.Spec.Backend.Docker.LoadBalancer.ImageTag,
- strconv.Itoa(dockerCluster.Spec.ControlPlaneEndpoint.Port))
+ strconv.Itoa(int(dockerCluster.Spec.ControlPlaneEndpoint.Port)))
if err != nil {
v1beta1conditions.MarkFalse(dockerCluster, infrav1.LoadBalancerAvailableV1Beta1Condition, infrav1.LoadBalancerProvisioningFailedV1Beta1Reason, clusterv1.ConditionSeverityWarning, "%s", err.Error())
conditions.Set(dockerCluster, metav1.Condition{
diff --git a/test/infrastructure/docker/internal/controllers/backends/docker/dockermachine_backend.go b/test/infrastructure/docker/internal/controllers/backends/docker/dockermachine_backend.go
index 94d8ec3bff23..6a655c986670 100644
--- a/test/infrastructure/docker/internal/controllers/backends/docker/dockermachine_backend.go
+++ b/test/infrastructure/docker/internal/controllers/backends/docker/dockermachine_backend.go
@@ -115,7 +115,7 @@ func (r *MachineBackendReconciler) ReconcileNormal(ctx context.Context, cluster
}
// if the machine is already provisioned, return
- if dockerMachine.Spec.ProviderID != nil {
+ if dockerMachine.Spec.ProviderID != "" {
// ensure ready state is set.
// This is required after move, because status is not moved to the target cluster.
dockerMachine.Status.Initialization = &infrav1.DevMachineInitializationStatus{
@@ -361,8 +361,7 @@ func (r *MachineBackendReconciler) ReconcileNormal(ctx context.Context, cluster
return ctrl.Result{RequeueAfter: 5 * time.Second}, nil
}
// Set ProviderID so the Cluster API Machine Controller can pull it
- providerID := externalMachine.ProviderID()
- dockerMachine.Spec.ProviderID = &providerID
+ dockerMachine.Spec.ProviderID = externalMachine.ProviderID()
dockerMachine.Status.Initialization = &infrav1.DevMachineInitializationStatus{
Provisioned: ptr.To(true),
}
@@ -399,7 +398,7 @@ func (r *MachineBackendReconciler) getExternalObjects(ctx context.Context, clust
externalLoadBalancer, err := docker.NewLoadBalancer(ctx, cluster,
imageRepository,
imageTag,
- strconv.Itoa(dockerCluster.Spec.ControlPlaneEndpoint.Port))
+ strconv.Itoa(int(dockerCluster.Spec.ControlPlaneEndpoint.Port)))
if err != nil {
return nil, nil, errors.Wrapf(err, "failed to create helper for managing the externalLoadBalancer")
}
@@ -463,7 +462,7 @@ func (r *MachineBackendReconciler) PatchDevMachine(ctx context.Context, patchHel
infrav1.ContainerProvisionedV1Beta1Condition,
infrav1.BootstrapExecSucceededV1Beta1Condition,
),
- v1beta1conditions.WithStepCounterIf(dockerMachine.DeletionTimestamp.IsZero() && dockerMachine.Spec.ProviderID == nil),
+ v1beta1conditions.WithStepCounterIf(dockerMachine.DeletionTimestamp.IsZero() && dockerMachine.Spec.ProviderID == ""),
)
if err := conditions.SetSummaryCondition(dockerMachine, dockerMachine, infrav1.DevMachineReadyCondition,
conditions.ForConditionTypes{
diff --git a/test/infrastructure/docker/internal/controllers/backends/inmemory/inmemorymachine_backend.go b/test/infrastructure/docker/internal/controllers/backends/inmemory/inmemorymachine_backend.go
index a55391fc7670..24a6a53ff121 100644
--- a/test/infrastructure/docker/internal/controllers/backends/inmemory/inmemorymachine_backend.go
+++ b/test/infrastructure/docker/internal/controllers/backends/inmemory/inmemorymachine_backend.go
@@ -227,7 +227,7 @@ func (r *MachineBackendReconciler) reconcileNormalCloudMachine(ctx context.Conte
// TODO: consider if to surface VM provisioned also on the cloud machine (currently it surfaces only on the inMemoryMachine)
- inMemoryMachine.Spec.ProviderID = ptr.To(calculateProviderID(inMemoryMachine))
+ inMemoryMachine.Spec.ProviderID = calculateProviderID(inMemoryMachine)
inMemoryMachine.Status.Initialization = &infrav1.DevMachineInitializationStatus{
Provisioned: ptr.To(true),
}
@@ -1241,7 +1241,7 @@ func (r *MachineBackendReconciler) PatchDevMachine(ctx context.Context, patchHel
// A step counter is added to represent progress during the provisioning process (instead we are hiding the step counter during the deletion process).
v1beta1conditions.SetSummary(inMemoryMachine,
v1beta1conditions.WithConditions(inMemoryMachineV1Beta1Conditions...),
- v1beta1conditions.WithStepCounterIf(inMemoryMachine.DeletionTimestamp.IsZero() && inMemoryMachine.Spec.ProviderID == nil),
+ v1beta1conditions.WithStepCounterIf(inMemoryMachine.DeletionTimestamp.IsZero() && inMemoryMachine.Spec.ProviderID == ""),
)
if err := conditions.SetSummaryCondition(inMemoryMachine, inMemoryMachine, infrav1.DevMachineReadyCondition,
inMemoryMachineConditions,
diff --git a/test/infrastructure/docker/internal/controllers/dockermachine_controller.go b/test/infrastructure/docker/internal/controllers/dockermachine_controller.go
index cb0df56476d5..b3f43ff763c9 100644
--- a/test/infrastructure/docker/internal/controllers/dockermachine_controller.go
+++ b/test/infrastructure/docker/internal/controllers/dockermachine_controller.go
@@ -253,7 +253,7 @@ func patchDockerMachine(ctx context.Context, patchHelper *patch.Helper, dockerMa
infrav1.ContainerProvisionedV1Beta1Condition,
infrav1.BootstrapExecSucceededV1Beta1Condition,
),
- v1beta1conditions.WithStepCounterIf(dockerMachine.DeletionTimestamp.IsZero() && dockerMachine.Spec.ProviderID == nil),
+ v1beta1conditions.WithStepCounterIf(dockerMachine.DeletionTimestamp.IsZero() && dockerMachine.Spec.ProviderID == ""),
)
if err := conditions.SetSummaryCondition(dockerMachine, dockerMachine, infrav1.DevMachineReadyCondition,
conditions.ForConditionTypes{
diff --git a/test/infrastructure/inmemory/pkg/server/listener.go b/test/infrastructure/inmemory/pkg/server/listener.go
index b98f5a00eaf2..c1f71b01b762 100644
--- a/test/infrastructure/inmemory/pkg/server/listener.go
+++ b/test/infrastructure/inmemory/pkg/server/listener.go
@@ -37,7 +37,7 @@ import (
// WorkloadClusterListener represents a listener for a workload cluster.
type WorkloadClusterListener struct {
host string
- port int
+ port int32
resourceGroup string
@@ -63,7 +63,7 @@ func (s *WorkloadClusterListener) Host() string {
}
// Port returns the port of a WorkloadClusterListener.
-func (s *WorkloadClusterListener) Port() int {
+func (s *WorkloadClusterListener) Port() int32 {
return s.port
}
diff --git a/test/infrastructure/inmemory/pkg/server/mux.go b/test/infrastructure/inmemory/pkg/server/mux.go
index 948d177b3ce8..7246ae6473b7 100644
--- a/test/infrastructure/inmemory/pkg/server/mux.go
+++ b/test/infrastructure/inmemory/pkg/server/mux.go
@@ -64,9 +64,9 @@ type WorkloadClustersMuxOption interface {
// WorkloadClustersMuxOptions are options for the workload clusters mux.
type WorkloadClustersMuxOptions struct {
- MinPort int
- MaxPort int
- DebugPort int
+ MinPort int32
+ MaxPort int32
+ DebugPort int32
}
// ApplyOptions applies WorkloadClustersMuxOption to the current WorkloadClustersMuxOptions.
@@ -79,9 +79,9 @@ func (o *WorkloadClustersMuxOptions) ApplyOptions(opts []WorkloadClustersMuxOpti
// CustomPorts allows to customize the ports used by the workload clusters mux.
type CustomPorts struct {
- MinPort int
- MaxPort int
- DebugPort int
+ MinPort int32
+ MaxPort int32
+ DebugPort int32
}
// Apply applies this configuration to the given WorkloadClustersMuxOptions.
@@ -98,9 +98,9 @@ func (c CustomPorts) Apply(options *WorkloadClustersMuxOptions) {
// WorkloadClustersMux is also responsible for handling certificates for each of the above use cases.
type WorkloadClustersMux struct {
host string
- minPort int // TODO: move port management to a port range type
- maxPort int
- portIndex int
+ minPort int32 // TODO: move port management to a port range type
+ maxPort int32
+ portIndex int32
manager inmemoryruntime.Manager // TODO: figure out if we can have a smaller interface (GetResourceGroup, GetSchema)
@@ -253,7 +253,7 @@ type HotRestartListener struct {
Cluster string
Name string
Host string
- Port int
+ Port int32
}
// HotRestart tries to set up the mux according to an existing set of InMemoryClusters.
@@ -270,7 +270,7 @@ func (m *WorkloadClustersMux) HotRestart(listeners []HotRestartListener) error {
return errors.New("WorkloadClustersMux cannot be hot restarted when there are already initialized listeners")
}
- ports := sets.Set[int]{}
+ ports := sets.Set[int32]{}
maxPort := m.minPort - 1
for _, l := range listeners {
if l.Host == "" {
@@ -322,7 +322,7 @@ func (m *WorkloadClustersMux) InitWorkloadClusterListener(wclName string) (*Work
// initWorkloadClusterListenerWithPortLocked initializes a workload cluster listener.
// Note: m.lock must be locked before calling this method.
-func (m *WorkloadClustersMux) initWorkloadClusterListenerWithPortLocked(wclName string, port int) *WorkloadClusterListener {
+func (m *WorkloadClustersMux) initWorkloadClusterListenerWithPortLocked(wclName string, port int32) *WorkloadClusterListener {
wcl := &WorkloadClusterListener{
scheme: m.manager.GetScheme(),
host: m.host,
@@ -643,7 +643,7 @@ func (m *WorkloadClustersMux) Shutdown(ctx context.Context) error {
// getFreePortLocked gets a free port.
// Note: m.lock must be locked before calling this method.
-func (m *WorkloadClustersMux) getFreePortLocked() (int, error) {
+func (m *WorkloadClustersMux) getFreePortLocked() (int32, error) {
port := m.portIndex
if port > m.maxPort {
return -1, errors.Errorf("no more free ports in the %d-%d range", m.minPort, m.maxPort)