/
default_machine_deployment.go
64 lines (57 loc) · 2.11 KB
/
default_machine_deployment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package unittest
import (
infrastructurev1alpha3 "github.com/giantswarm/apiextensions/v6/pkg/apis/infrastructure/v1alpha3"
"github.com/giantswarm/to"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/giantswarm/aws-operator/v13/pkg/annotation"
"github.com/giantswarm/aws-operator/v13/pkg/label"
)
const (
DefaultMachineDeploymentID = "al9qy"
)
func DefaultMachineDeployment() infrastructurev1alpha3.AWSMachineDeployment {
cr := infrastructurev1alpha3.AWSMachineDeployment{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
annotation.MachineDeploymentSubnet: "10.100.8.0/24",
},
Labels: map[string]string{
label.Cluster: DefaultClusterID,
label.MachineDeployment: DefaultMachineDeploymentID,
label.OperatorVersion: "7.3.0",
label.Release: "100.0.0",
},
Name: DefaultMachineDeploymentID,
Namespace: metav1.NamespaceDefault,
},
Spec: infrastructurev1alpha3.AWSMachineDeploymentSpec{
NodePool: infrastructurev1alpha3.AWSMachineDeploymentSpecNodePool{
Description: "Test node pool for cluster in template rendering unit test.",
Machine: infrastructurev1alpha3.AWSMachineDeploymentSpecNodePoolMachine{
DockerVolumeSizeGB: 100,
KubeletVolumeSizeGB: 100,
},
Scaling: infrastructurev1alpha3.AWSMachineDeploymentSpecNodePoolScaling{
Max: 5,
Min: 3,
},
},
Provider: infrastructurev1alpha3.AWSMachineDeploymentSpecProvider{
AvailabilityZones: []string{"eu-central-1a", "eu-central-1c"},
InstanceDistribution: infrastructurev1alpha3.AWSMachineDeploymentSpecInstanceDistribution{
OnDemandBaseCapacity: 0,
OnDemandPercentageAboveBaseCapacity: to.IntP(100),
},
Worker: infrastructurev1alpha3.AWSMachineDeploymentSpecProviderWorker{
InstanceType: "m5.2xlarge",
UseAlikeInstanceTypes: true,
},
},
},
}
return cr
}
func MachineDeploymentWithAZs(machineDeployment infrastructurev1alpha3.AWSMachineDeployment, azs []string) infrastructurev1alpha3.AWSMachineDeployment {
machineDeployment.Spec.Provider.AvailabilityZones = azs
return machineDeployment
}