Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci-kal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ linters:
enable:
#- "commentstart" # Ensure comments start with the serialized version of the field name.
#- "conditions" # Ensure conditions have the correct json tags and markers.
#- "integers" # Ensure only int32 and int64 are used for integers.
- "integers" # Ensure only int32 and int64 are used for integers.
#- "jsontags" # Ensure every field has a json tag.
#- "maxlength" # Ensure all strings and arrays have maximum lengths/maximum items.
#- "nobools" # Bools do not evolve over time, should use enums instead.
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta2/network_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ type VPCSpec struct {
// default subnets. Defaults to 3
// +kubebuilder:default=3
// +kubebuilder:validation:Minimum=1
AvailabilityZoneUsageLimit *int `json:"availabilityZoneUsageLimit,omitempty"`
AvailabilityZoneUsageLimit *int32 `json:"availabilityZoneUsageLimit,omitempty"`

// AvailabilityZoneSelection specifies how AZs should be selected if there are more AZs
// in a region than specified by AvailabilityZoneUsageLimit. There are 2 selection schemes:
Expand Down
8 changes: 4 additions & 4 deletions controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ type NetworkSpec struct {
// Network host prefix which is defaulted to `23` if not specified.
// +kubebuilder:default=23
// +optional
HostPrefix int `json:"hostPrefix,omitempty"`
HostPrefix int32 `json:"hostPrefix,omitempty"`

// The CNI network type default is OVNKubernetes.
// +kubebuilder:validation:Enum=OVNKubernetes;Other
Expand All @@ -392,15 +392,15 @@ type DefaultMachinePoolSpec struct {
// +kubebuilder:validation:Maximum=16384
// +immutable
// +optional
VolumeSize int `json:"volumeSize,omitempty"`
VolumeSize int32 `json:"volumeSize,omitempty"`
}

// AutoScaling specifies scaling options.
type AutoScaling struct {
// +kubebuilder:validation:Minimum=1
MinReplicas int `json:"minReplicas,omitempty"`
MinReplicas int32 `json:"minReplicas,omitempty"`
// +kubebuilder:validation:Minimum=1
MaxReplicas int `json:"maxReplicas,omitempty"`
MaxReplicas int32 `json:"maxReplicas,omitempty"`
}

// AWSRolesRef contains references to various AWS IAM roles required for operators to make calls against the AWS API.
Expand Down
12 changes: 4 additions & 8 deletions controlplane/rosa/controllers/rosacontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,20 +1101,16 @@ func buildOCMClusterSpec(controlPlaneSpec rosacontrolplanev1.RosaControlPlaneSpe
ocmClusterSpec.ServiceCIDR = *serviceCIDR
}

ocmClusterSpec.HostPrefix = networkSpec.HostPrefix
ocmClusterSpec.NetworkType = networkSpec.NetworkType
}

if controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize >= 75 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not right, Why removing this check ? I believe the 75 there cause volume size cannot be less than 75G

ocmClusterSpec.MachinePoolRootDisk = &ocm.Volume{Size: controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize}
ocmClusterSpec.HostPrefix = int(networkSpec.HostPrefix)
ocmClusterSpec.MachinePoolRootDisk = &ocm.Volume{Size: int(controlPlaneSpec.DefaultMachinePoolSpec.VolumeSize)}
}

// Set cluster compute autoscaling replicas
// In case autoscaling is not defined and multiple zones defined, set the compute nodes equal to the zones count.
if computeAutoscaling := controlPlaneSpec.DefaultMachinePoolSpec.Autoscaling; computeAutoscaling != nil {
ocmClusterSpec.Autoscaling = true
ocmClusterSpec.MaxReplicas = computeAutoscaling.MaxReplicas
ocmClusterSpec.MinReplicas = computeAutoscaling.MinReplicas
ocmClusterSpec.MaxReplicas = int(computeAutoscaling.MaxReplicas)
ocmClusterSpec.MinReplicas = int(computeAutoscaling.MinReplicas)
} else if len(ocmClusterSpec.AvailabilityZones) > 1 {
ocmClusterSpec.ComputeNodes = len(ocmClusterSpec.AvailabilityZones)
}
Expand Down
2 changes: 1 addition & 1 deletion exp/api/v1beta2/rosamachinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type RosaMachinePoolSpec struct {
// +kubebuilder:validation:Maximum=16384
// +immutable
// +optional
VolumeSize int `json:"volumeSize,omitempty"`
VolumeSize int32 `json:"volumeSize,omitempty"`

// ProviderIDList contain a ProviderID for each machine instance that's currently managed by this machine pool.
// +optional
Expand Down
6 changes: 3 additions & 3 deletions exp/controllers/rosamachinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
if rosaMachinePoolSpec.Autoscaling != nil {
npBuilder = npBuilder.Autoscaling(
cmv1.NewNodePoolAutoscaling().
MinReplica(rosaMachinePoolSpec.Autoscaling.MinReplicas).
MaxReplica(rosaMachinePoolSpec.Autoscaling.MaxReplicas))
MinReplica(int(rosaMachinePoolSpec.Autoscaling.MinReplicas)).
MaxReplica(int(rosaMachinePoolSpec.Autoscaling.MaxReplicas)))
} else {
replicas := 1
if machinePoolSpec.Replicas != nil {
Expand All @@ -510,7 +510,7 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
awsNodePool = awsNodePool.Tags(rosaMachinePoolSpec.AdditionalTags)
}
if rosaMachinePoolSpec.VolumeSize > 75 {
awsNodePool = awsNodePool.RootVolume(cmv1.NewAWSVolume().Size(rosaMachinePoolSpec.VolumeSize))
awsNodePool = awsNodePool.RootVolume(cmv1.NewAWSVolume().Size(int(rosaMachinePoolSpec.VolumeSize)))
}
if rosaMachinePoolSpec.CapacityReservationID != "" {
capacityReservation := cmv1.NewAWSCapacityReservation().Id(rosaMachinePoolSpec.CapacityReservationID)
Expand Down
2 changes: 1 addition & 1 deletion exp/controllers/rosanetwork_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (r *ROSANetworkReconciler) reconcileNormal(ctx context.Context, rosaNetScop

zoneCount := 1
if rosaNetScope.ROSANetwork.Spec.AvailabilityZoneCount > 0 {
zoneCount = rosaNetScope.ROSANetwork.Spec.AvailabilityZoneCount
zoneCount = int(rosaNetScope.ROSANetwork.Spec.AvailabilityZoneCount)
}
cfParams := map[string]string{
"AvailabilityZoneCount": strconv.Itoa(zoneCount),
Expand Down
6 changes: 3 additions & 3 deletions exp/utils/rosa_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NodePoolToRosaMachinePoolSpec(nodePool *cmv1.NodePool) expinfrav1.RosaMachi
InstanceType: nodePool.AWSNodePool().InstanceType(),
TuningConfigs: nodePool.TuningConfigs(),
AdditionalSecurityGroups: nodePool.AWSNodePool().AdditionalSecurityGroupIds(),
VolumeSize: nodePool.AWSNodePool().RootVolume().Size(),
VolumeSize: int32(nodePool.AWSNodePool().RootVolume().Size()),
CapacityReservationID: nodePool.AWSNodePool().CapacityReservation().Id(),
// nodePool.AWSNodePool().Tags() returns all tags including "system" tags if "fetchUserTagsOnly" parameter is not specified.
// TODO: enable when AdditionalTags day2 changes is supported.
Expand All @@ -52,8 +52,8 @@ func NodePoolToRosaMachinePoolSpec(nodePool *cmv1.NodePool) expinfrav1.RosaMachi

if nodePool.Autoscaling() != nil {
spec.Autoscaling = &rosacontrolplanev1.AutoScaling{
MinReplicas: nodePool.Autoscaling().MinReplica(),
MaxReplicas: nodePool.Autoscaling().MaxReplica(),
MinReplicas: int32(nodePool.Autoscaling().MinReplica()),
MaxReplicas: int32(nodePool.Autoscaling().MaxReplica()),
}
}
if nodePool.Taints() != nil {
Expand Down