Skip to content

Commit

Permalink
target only v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
zmalik authored and zain.malik committed Nov 18, 2021
1 parent e6b7672 commit b932d67
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 191 deletions.
7 changes: 1 addition & 6 deletions azure/scope/managedcontrolplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,8 @@ func (s *ManagedControlPlaneScope) AgentPoolSpec() azure.AgentPoolSpec {
replicas = *s.MachinePool.Spec.Replicas
}

poolName := s.InfraMachinePool.GetName()
if s.InfraMachinePool.Spec.Name != nil {
poolName = *s.InfraMachinePool.Spec.Name
}

agentPoolSpec := azure.AgentPoolSpec{
Name: poolName,
Name: to.String(s.InfraMachinePool.Spec.Name),
ResourceGroup: s.ControlPlane.Spec.ResourceGroupName,
Cluster: s.ControlPlane.Name,
SKU: s.InfraMachinePool.Spec.SKU,
Expand Down
1 change: 1 addition & 0 deletions azure/scope/managedcontrolplane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func getAzureMachinePool(name string, mode infrav1.NodePoolMode) *infrav1.AzureM
Spec: infrav1.AzureManagedMachinePoolSpec{
Mode: string(mode),
SKU: "Standard_D2s_v3",
Name: to.StringPtr(name),
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@ spec:
items:
type: string
type: array
scaling:
description: Scaling specifies the autoscaling parameters for the
node pool.
properties:
maxSize:
format: int32
type: integer
minSize:
format: int32
type: integer
type: object
sku:
description: SKU is the size of the VMs in the node pool.
type: string
Expand Down Expand Up @@ -151,17 +140,6 @@ spec:
items:
type: string
type: array
scaling:
description: Scaling specifies the autoscaling parameters for the
node pool.
properties:
maxSize:
format: int32
type: integer
minSize:
format: int32
type: integer
type: object
sku:
description: SKU is the size of the VMs in the node pool.
type: string
Expand Down
1 change: 1 addition & 0 deletions exp/api/v1alpha3/azuremanagedmachinepool_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error { //
}

dst.Spec.Name = restored.Spec.Name
dst.Spec.Scaling = restored.Spec.Scaling

return nil
}
Expand Down
10 changes: 0 additions & 10 deletions exp/api/v1alpha3/azuremanagedmachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ type AzureManagedMachinePoolSpec struct {
// ProviderIDList is the unique identifier as specified by the cloud provider.
// +optional
ProviderIDList []string `json:"providerIDList,omitempty"`

// Scaling specifies the autoscaling parameters for the node pool.
// +optional
Scaling *ManagedMachinePoolScaling `json:"scaling,omitempty"`
}

// ManagedMachinePoolScaling specifies scaling options.
type ManagedMachinePoolScaling struct {
MinSize *int32 `json:"minSize,omitempty"`
MaxSize *int32 `json:"maxSize,omitempty"`
}

// AzureManagedMachinePoolStatus defines the observed state of AzureManagedMachinePool.
Expand Down
35 changes: 1 addition & 34 deletions exp/api/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions exp/api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 28 additions & 3 deletions exp/api/v1alpha4/azuremanagedmachinepool_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,45 @@ limitations under the License.
package v1alpha4

import (
apiconversion "k8s.io/apimachinery/pkg/conversion"
expv1beta1 "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1"
utilconversion "sigs.k8s.io/cluster-api/util/conversion"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// ConvertTo converts this AzureManagedMachinePool to the Hub version (v1beta1).
func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error { // nolint
func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*expv1beta1.AzureManagedMachinePool)

if err := Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(src, dst, nil); err != nil {
return err
}

// Manually restore data.
restored := &expv1beta1.AzureManagedMachinePool{}
if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok {
return err
}
dst.Spec.Scaling = restored.Spec.Scaling
return Convert_v1alpha4_AzureManagedMachinePool_To_v1beta1_AzureManagedMachinePool(src, dst, nil)
}

// ConvertFrom converts from the Hub version (v1beta1) to this version.
func (dst *AzureManagedMachinePool) ConvertFrom(srcRaw conversion.Hub) error { // nolint
func (dst *AzureManagedMachinePool) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*expv1beta1.AzureManagedMachinePool)

return Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(src, dst, nil)
if err := Convert_v1beta1_AzureManagedMachinePool_To_v1alpha4_AzureManagedMachinePool(src, dst, nil); err != nil {
return err
}

// Preserve Hub data on down-conversion.
if err := utilconversion.MarshalData(src, dst); err != nil {
return err
}

return nil
}

func Convert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(in *expv1beta1.AzureManagedMachinePoolSpec, out *AzureManagedMachinePoolSpec, s apiconversion.Scope) error {
return autoConvert_v1beta1_AzureManagedMachinePoolSpec_To_v1alpha4_AzureManagedMachinePoolSpec(in, out, s)
}
10 changes: 0 additions & 10 deletions exp/api/v1alpha4/azuremanagedmachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ type AzureManagedMachinePoolSpec struct {
// ProviderIDList is the unique identifier as specified by the cloud provider.
// +optional
ProviderIDList []string `json:"providerIDList,omitempty"`

// Scaling specifies the autoscaling parameters for the node pool.
// +optional
Scaling *ManagedMachinePoolScaling `json:"scaling,omitempty"`
}

// ManagedMachinePoolScaling specifies scaling options.
type ManagedMachinePoolScaling struct {
MinSize *int32 `json:"minSize,omitempty"`
MaxSize *int32 `json:"maxSize,omitempty"`
}

// AzureManagedMachinePoolStatus defines the observed state of AzureManagedMachinePool.
Expand Down
74 changes: 28 additions & 46 deletions exp/api/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b932d67

Please sign in to comment.