Skip to content

Commit 1b58c42

Browse files
authored
Update goformation from latest schema / Remove unused generated code (#8289)
* skip generating code for things we don't use Signed-off-by: Davanum Srinivas <davanum@gmail.com> * use go:generate in goformation.go to regenerate code Signed-off-by: Davanum Srinivas <davanum@gmail.com> * add explicit error when a type is not found Signed-off-by: Davanum Srinivas <davanum@gmail.com> * fix test cases Signed-off-by: Davanum Srinivas <davanum@gmail.com> --------- Signed-off-by: Davanum Srinivas <davanum@gmail.com>
1 parent b1214cb commit 1b58c42

3,648 files changed

Lines changed: 72955 additions & 653891 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pkg/cfn/builder/cluster.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,21 @@ func (c *ClusterResourceSet) addResourcesForControlPlane(subnetDetails *SubnetDe
390390
}
391391
cluster.KubernetesNetworkConfig = kubernetesNetworkConfig
392392
if c.spec.ZonalShiftConfig != nil && api.IsEnabled(c.spec.ZonalShiftConfig.Enabled) {
393-
cluster.ZonalShiftConfig = &gfneks.Cluster_ZonalShift{
393+
cluster.ZonalShiftConfig = &gfneks.Cluster_ZonalShiftConfig{
394394
Enabled: gfnt.NewBoolean(true),
395395
}
396396
}
397397

398398
if c.spec.HasRemoteNetworkingConfigured() {
399399
cluster.RemoteNetworkConfig = &gfneks.Cluster_RemoteNetworkConfig{}
400400
for _, remoteNetwork := range c.spec.RemoteNetworkConfig.RemotePodNetworks {
401-
cluster.RemoteNetworkConfig.RemotePodNetworks = append(cluster.RemoteNetworkConfig.RemotePodNetworks, gfneks.RemoteNetworks{
402-
CIDRs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
401+
cluster.RemoteNetworkConfig.RemotePodNetworks = append(cluster.RemoteNetworkConfig.RemotePodNetworks, gfneks.Cluster_RemotePodNetwork{
402+
Cidrs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
403403
})
404404
}
405405
for _, remoteNetwork := range c.spec.RemoteNetworkConfig.RemoteNodeNetworks {
406-
cluster.RemoteNetworkConfig.RemoteNodeNetworks = append(cluster.RemoteNetworkConfig.RemoteNodeNetworks, gfneks.RemoteNetworks{
407-
CIDRs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
406+
cluster.RemoteNetworkConfig.RemoteNodeNetworks = append(cluster.RemoteNetworkConfig.RemoteNodeNetworks, gfneks.Cluster_RemoteNodeNetwork{
407+
Cidrs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
408408
})
409409
}
410410
}

pkg/cfn/builder/iam.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/aws/aws-sdk-go-v2/aws"
98
"github.com/aws/aws-sdk-go-v2/service/cloudformation/types"
109
"github.com/kris-nova/logger"
1110

@@ -145,12 +144,13 @@ func (c *ClusterResourceSet) addIAMRolesAnywhere() {
145144
Enabled: gfnt.NewBoolean(true),
146145
Name: makeName("CA"),
147146
Source: &gfnrolesanywhere.TrustAnchor_Source{
148-
SourceType: aws.String("CERTIFICATE_BUNDLE"),
149-
SourceData: &gfnrolesanywhere.TrustAnchor_SourceData{
150-
X509CertificateData: c.spec.RemoteNetworkConfig.IAM.CABundleCert,
151-
},
147+
SourceType: gfnt.NewString("CERTIFICATE_BUNDLE"),
148+
SourceData: &gfnrolesanywhere.TrustAnchor_SourceData{},
152149
},
153150
}
151+
if c.spec.RemoteNetworkConfig.IAM.CABundleCert != nil {
152+
trustAnchor.Source.SourceData.X509CertificateData = gfnt.NewString(*c.spec.RemoteNetworkConfig.IAM.CABundleCert)
153+
}
154154
anywhereProfile := &gfnrolesanywhere.Profile{
155155
Enabled: gfnt.NewBoolean(true),
156156
Name: makeName("remote-nodes"),

pkg/cfn/builder/managed_nodegroup.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ func NewManagedNodeGroup(ec2API awsapi.EC2, cluster *api.ClusterConfig, nodeGrou
4848
}
4949
}
5050

51+
func convertToTypesValueMap(input map[string]string) map[string]*gfnt.Value {
52+
output := make(map[string]*gfnt.Value)
53+
for k, v := range input {
54+
output[k] = gfnt.NewString(v)
55+
}
56+
return output
57+
}
58+
5159
// AddAllResources adds all required CloudFormation resources
5260
func (m *ManagedNodeGroupResourceSet) AddAllResources(ctx context.Context) error {
5361
m.resourceSet.template.Description = fmt.Sprintf(
@@ -101,8 +109,8 @@ func (m *ManagedNodeGroupResourceSet) AddAllResources(ctx context.Context) error
101109
ScalingConfig: &scalingConfig,
102110
Subnets: subnets,
103111
NodeRole: nodeRole,
104-
Labels: m.nodeGroup.Labels,
105-
Tags: m.nodeGroup.Tags,
112+
Labels: convertToTypesValueMap(m.nodeGroup.Labels),
113+
Tags: convertToTypesValueMap(m.nodeGroup.Tags),
106114
Taints: taints,
107115
}
108116

pkg/cfn/builder/testdata/custom_vpc_private_endpoint.json

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99
"sg-test"
1010
],
1111
"ServiceName": "com.amazonaws.us-west-2.ec2",
12-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
12+
"SubnetIds": [
13+
"subnet-custom1",
14+
"subnet-custom2"
15+
],
16+
"Tags": [
17+
{
18+
"Key": "Name",
19+
"Value": {
20+
"Fn::Sub": "${AWS::StackName}/VPCEndpointEC2"
21+
}
22+
}
23+
],
1324
"VpcEndpointType": "Interface",
1425
"VpcId": "vpc-custom"
1526
}
@@ -22,7 +33,18 @@
2233
"sg-test"
2334
],
2435
"ServiceName": "com.amazonaws.us-west-2.ecr.api",
25-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
36+
"SubnetIds": [
37+
"subnet-custom1",
38+
"subnet-custom2"
39+
],
40+
"Tags": [
41+
{
42+
"Key": "Name",
43+
"Value": {
44+
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRAPI"
45+
}
46+
}
47+
],
2648
"VpcEndpointType": "Interface",
2749
"VpcId": "vpc-custom"
2850
}
@@ -35,16 +57,38 @@
3557
"sg-test"
3658
],
3759
"ServiceName": "com.amazonaws.us-west-2.ecr.dkr",
38-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
60+
"SubnetIds": [
61+
"subnet-custom1",
62+
"subnet-custom2"
63+
],
64+
"Tags": [
65+
{
66+
"Key": "Name",
67+
"Value": {
68+
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRDKR"
69+
}
70+
}
71+
],
3972
"VpcEndpointType": "Interface",
4073
"VpcId": "vpc-custom"
4174
}
4275
},
4376
"VPCEndpointS3": {
4477
"Type": "AWS::EC2::VPCEndpoint",
4578
"Properties": {
46-
"RouteTableIds": ["rtb-custom-1", "rtb-custom-2"],
79+
"RouteTableIds": [
80+
"rtb-custom-1",
81+
"rtb-custom-2"
82+
],
4783
"ServiceName": "com.amazonaws.us-west-2.s3",
84+
"Tags": [
85+
{
86+
"Key": "Name",
87+
"Value": {
88+
"Fn::Sub": "${AWS::StackName}/VPCEndpointS3"
89+
}
90+
}
91+
],
4892
"VpcEndpointType": "Gateway",
4993
"VpcId": "vpc-custom"
5094
}
@@ -57,7 +101,18 @@
57101
"sg-test"
58102
],
59103
"ServiceName": "com.amazonaws.us-west-2.sts",
60-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
104+
"SubnetIds": [
105+
"subnet-custom1",
106+
"subnet-custom2"
107+
],
108+
"Tags": [
109+
{
110+
"Key": "Name",
111+
"Value": {
112+
"Fn::Sub": "${AWS::StackName}/VPCEndpointSTS"
113+
}
114+
}
115+
],
61116
"VpcEndpointType": "Interface",
62117
"VpcId": "vpc-custom"
63118
}

pkg/cfn/builder/testdata/custom_vpc_private_endpoint_same_route_table.json

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99
"sg-test"
1010
],
1111
"ServiceName": "com.amazonaws.us-west-2.ec2",
12-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
12+
"SubnetIds": [
13+
"subnet-custom1",
14+
"subnet-custom2"
15+
],
16+
"Tags": [
17+
{
18+
"Key": "Name",
19+
"Value": {
20+
"Fn::Sub": "${AWS::StackName}/VPCEndpointEC2"
21+
}
22+
}
23+
],
1324
"VpcEndpointType": "Interface",
1425
"VpcId": "vpc-custom"
1526
}
@@ -22,7 +33,18 @@
2233
"sg-test"
2334
],
2435
"ServiceName": "com.amazonaws.us-west-2.ecr.api",
25-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
36+
"SubnetIds": [
37+
"subnet-custom1",
38+
"subnet-custom2"
39+
],
40+
"Tags": [
41+
{
42+
"Key": "Name",
43+
"Value": {
44+
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRAPI"
45+
}
46+
}
47+
],
2648
"VpcEndpointType": "Interface",
2749
"VpcId": "vpc-custom"
2850
}
@@ -35,16 +57,37 @@
3557
"sg-test"
3658
],
3759
"ServiceName": "com.amazonaws.us-west-2.ecr.dkr",
38-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
60+
"SubnetIds": [
61+
"subnet-custom1",
62+
"subnet-custom2"
63+
],
64+
"Tags": [
65+
{
66+
"Key": "Name",
67+
"Value": {
68+
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRDKR"
69+
}
70+
}
71+
],
3972
"VpcEndpointType": "Interface",
4073
"VpcId": "vpc-custom"
4174
}
4275
},
4376
"VPCEndpointS3": {
4477
"Type": "AWS::EC2::VPCEndpoint",
4578
"Properties": {
46-
"RouteTableIds": ["rtb-custom-1"],
79+
"RouteTableIds": [
80+
"rtb-custom-1"
81+
],
4782
"ServiceName": "com.amazonaws.us-west-2.s3",
83+
"Tags": [
84+
{
85+
"Key": "Name",
86+
"Value": {
87+
"Fn::Sub": "${AWS::StackName}/VPCEndpointS3"
88+
}
89+
}
90+
],
4891
"VpcEndpointType": "Gateway",
4992
"VpcId": "vpc-custom"
5093
}
@@ -57,7 +100,18 @@
57100
"sg-test"
58101
],
59102
"ServiceName": "com.amazonaws.us-west-2.sts",
60-
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
103+
"SubnetIds": [
104+
"subnet-custom1",
105+
"subnet-custom2"
106+
],
107+
"Tags": [
108+
{
109+
"Key": "Name",
110+
"Value": {
111+
"Fn::Sub": "${AWS::StackName}/VPCEndpointSTS"
112+
}
113+
}
114+
],
61115
"VpcEndpointType": "Interface",
62116
"VpcId": "vpc-custom"
63117
}

pkg/cfn/builder/testdata/vpc_private.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@
232232
"Ref": "SubnetPrivateUSWEST2C"
233233
}
234234
],
235+
"Tags": [
236+
{
237+
"Key": "Name",
238+
"Value": {
239+
"Fn::Sub": "${AWS::StackName}/VPCEndpointEC2"
240+
}
241+
}
242+
],
235243
"VpcEndpointType": "Interface",
236244
"VpcId": {
237245
"Ref": "VPC"
@@ -260,6 +268,14 @@
260268
"Ref": "SubnetPrivateUSWEST2D"
261269
}
262270
],
271+
"Tags": [
272+
{
273+
"Key": "Name",
274+
"Value": {
275+
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRAPI"
276+
}
277+
}
278+
],
263279
"VpcEndpointType": "Interface",
264280
"VpcId": {
265281
"Ref": "VPC"
@@ -288,6 +304,14 @@
288304
"Ref": "SubnetPrivateUSWEST2D"
289305
}
290306
],
307+
"Tags": [
308+
{
309+
"Key": "Name",
310+
"Value": {
311+
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRDKR"
312+
}
313+
}
314+
],
291315
"VpcEndpointType": "Interface",
292316
"VpcId": {
293317
"Ref": "VPC"
@@ -312,6 +336,14 @@
312336
}
313337
],
314338
"ServiceName": "com.amazonaws.us-west-2.s3",
339+
"Tags": [
340+
{
341+
"Key": "Name",
342+
"Value": {
343+
"Fn::Sub": "${AWS::StackName}/VPCEndpointS3"
344+
}
345+
}
346+
],
315347
"VpcEndpointType": "Gateway",
316348
"VpcId": {
317349
"Ref": "VPC"
@@ -337,6 +369,14 @@
337369
"Ref": "SubnetPrivateUSWEST2C"
338370
}
339371
],
372+
"Tags": [
373+
{
374+
"Key": "Name",
375+
"Value": {
376+
"Fn::Sub": "${AWS::StackName}/VPCEndpointSTS"
377+
}
378+
}
379+
],
340380
"VpcEndpointType": "Interface",
341381
"VpcId": {
342382
"Ref": "VPC"

0 commit comments

Comments
 (0)