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
30 changes: 24 additions & 6 deletions pkg/asset/machines/aws/clusterapi_machinesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
capa "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capi "sigs.k8s.io/cluster-api/api/core/v1beta2"

"github.com/openshift/installer/pkg/types"
"github.com/openshift/installer/pkg/types/aws"
"github.com/openshift/installer/pkg/utils"
)
Expand Down Expand Up @@ -56,6 +57,7 @@ func ClusterAPIMachineSets(in *MachineSetInput) ([]capa.AWSMachineTemplate, []ca
nodeLabels := map[string]string{
"node-role.kubernetes.io/worker": "",
}
nodeTaints := []capi.MachineTaint{}
instanceType := mpool.InstanceType
publicSubnet := in.PublicSubnet
subnetRef := &capa.AWSResourceReference{}
Expand All @@ -80,12 +82,27 @@ func ClusterAPIMachineSets(in *MachineSetInput) ([]capa.AWSMachineTemplate, []ca
}
}

// TODO: edge pools do not share same instance type and regular cluster workloads.
// The instance type is selected based in the offerings for the location.
// The labels and taints are set to prevent regular workloads.
// https://github.com/openshift/enhancements/blob/master/enhancements/installer/aws-custom-edge-machineset-local-zones.md
// FIXME: node taints on Machine/MachineSet is only supported in CAPI v1.12+ with feature gate MachineTaintPropagation.
// Until we bump the CAPI version, edge machines can only be provisioned via MAPI.
if in.Pool.Name == types.MachinePoolEdgeRoleName {
// edge pools do not share same instance type and regular cluster workloads.
// The instance type is selected based in the offerings for the location.
zone := in.Zones[az]
if zone.PreferredInstanceType != "" {
instanceType = zone.PreferredInstanceType
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

nodeLabels["node-role.kubernetes.io/edge"] = ""
nodeLabels["machine.openshift.io/zone-type"] = zone.Type
nodeLabels["machine.openshift.io/zone-group"] = zone.GroupName
nodeLabels["machine.openshift.io/parent-zone-name"] = zone.ParentZoneName

// The labels and taints are set to prevent regular workloads.
// https://github.com/openshift/enhancements/blob/master/enhancements/installer/aws-custom-edge-machineset-local-zones.md
nodeTaints = append(nodeTaints, capi.MachineTaint{
Key: "node-role.kubernetes.io/edge",
Effect: "NoSchedule",
Propagation: capi.MachineTaintPropagationAlways,
})
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

dedicatedHost := DedicatedHost(in.Hosts, mpool.HostPlacement, az)

Expand Down Expand Up @@ -185,6 +202,7 @@ func ClusterAPIMachineSets(in *MachineSetInput) ([]capa.AWSMachineTemplate, []ca
Name: name,
},
FailureDomain: az,
Taints: nodeTaints,
},
},
},
Expand Down
Loading