@@ -14,6 +14,9 @@ import (
14
14
const (
15
15
AWSControlPlaneInstanceType InstanceType = "m5.xlarge"
16
16
AWSWorkerInstanceType InstanceType = "m5.2xlarge"
17
+
18
+ AWSControlPlaneInstanceProfile IAMInstanceProfile = "control-plane.cluster-api-provider-aws.sigs.k8s.io"
19
+ AWSWorkerInstanceProfile IAMInstanceProfile = "nodes.cluster-api-provider-aws.sigs.k8s.io"
17
20
)
18
21
19
22
type AWSNodeSpec struct {
@@ -34,13 +37,15 @@ type AWSNodeSpec struct {
34
37
35
38
func NewAWSControlPlaneNodeSpec () * AWSNodeSpec {
36
39
return & AWSNodeSpec {
37
- InstanceType : ptr .To (AWSControlPlaneInstanceType ),
40
+ InstanceType : ptr .To (AWSControlPlaneInstanceType ),
41
+ IAMInstanceProfile : ptr .To (AWSControlPlaneInstanceProfile ),
38
42
}
39
43
}
40
44
41
45
func NewAWSWorkerNodeSpec () * AWSNodeSpec {
42
46
return & AWSNodeSpec {
43
- InstanceType : ptr .To (AWSWorkerInstanceType ),
47
+ InstanceType : ptr .To (AWSWorkerInstanceType ),
48
+ IAMInstanceProfile : ptr .To (AWSWorkerInstanceProfile ),
44
49
}
45
50
}
46
51
@@ -75,7 +80,7 @@ func (a AWSNodeSpec) VariableSchema() clusterv1.VariableSchema {
75
80
Description : "AWS Node configuration" ,
76
81
Type : "object" ,
77
82
Properties : map [string ]clusterv1.JSONSchemaProps {
78
- "iamInstanceProfile" : IAMInstanceProfile ( "" ) .VariableSchema ().OpenAPIV3Schema ,
83
+ "iamInstanceProfile" : a . IAMInstanceProfile .VariableSchema ().OpenAPIV3Schema ,
79
84
"instanceType" : a .InstanceType .VariableSchema ().OpenAPIV3Schema ,
80
85
"ami" : AMISpec {}.VariableSchema ().OpenAPIV3Schema ,
81
86
"additionalSecurityGroups" : AdditionalSecurityGroup {}.VariableSchema ().OpenAPIV3Schema ,
@@ -87,11 +92,12 @@ func (a AWSNodeSpec) VariableSchema() clusterv1.VariableSchema {
87
92
88
93
type IAMInstanceProfile string
89
94
90
- func (IAMInstanceProfile ) VariableSchema () clusterv1.VariableSchema {
95
+ func (i IAMInstanceProfile ) VariableSchema () clusterv1.VariableSchema {
91
96
return clusterv1.VariableSchema {
92
97
OpenAPIV3Schema : clusterv1.JSONSchemaProps {
93
98
Type : "string" ,
94
99
Description : "The IAM instance profile to use for the cluster Machines" ,
100
+ Default : variables .MustMarshal (i ),
95
101
},
96
102
}
97
103
}
0 commit comments