in pkg/cloudprovider/fake/cloudprovider.go [37:79]
func (c *CloudProvider) Create(_ context.Context, constraints *v1alpha5.Constraints, instanceTypes []cloudprovider.InstanceType, quantity int, bind func(*v1.Node) error) error {
var err error
for i := 0; i < quantity; i++ {
name := strings.ToLower(randomdata.SillyName())
instance := instanceTypes[0]
var zone, capacityType string
for _, o := range instance.Offerings() {
if constraints.Requirements.CapacityTypes().Has(o.CapacityType) {
if constraints.Requirements.Zones().Has(o.Zone) {
zone = o.Zone
capacityType = o.CapacityType
break
}
}
}
err = multierr.Append(err, bind(&v1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: map[string]string{
v1.LabelTopologyZone: zone,
v1.LabelInstanceTypeStable: instance.Name(),
v1alpha5.LabelCapacityType: capacityType,
},
},
Spec: v1.NodeSpec{
ProviderID: fmt.Sprintf("fake:///%s/%s", name, zone),
},
Status: v1.NodeStatus{
NodeInfo: v1.NodeSystemInfo{
Architecture: instance.Architecture(),
OperatingSystem: v1alpha5.OperatingSystemLinux,
},
Allocatable: v1.ResourceList{
v1.ResourcePods: *instance.Pods(),
v1.ResourceCPU: *instance.CPU(),
v1.ResourceMemory: *instance.Memory(),
},
},
}))
}
return err
}