Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update goformation from latest schema / Remove unused generated code #8289

Merged
merged 4 commits into from
Mar 7, 2025
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 5 additions & 5 deletions pkg/cfn/builder/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,21 +390,21 @@ func (c *ClusterResourceSet) addResourcesForControlPlane(subnetDetails *SubnetDe
}
cluster.KubernetesNetworkConfig = kubernetesNetworkConfig
if c.spec.ZonalShiftConfig != nil && api.IsEnabled(c.spec.ZonalShiftConfig.Enabled) {
cluster.ZonalShiftConfig = &gfneks.Cluster_ZonalShift{
cluster.ZonalShiftConfig = &gfneks.Cluster_ZonalShiftConfig{
Enabled: gfnt.NewBoolean(true),
}
}

if c.spec.HasRemoteNetworkingConfigured() {
cluster.RemoteNetworkConfig = &gfneks.Cluster_RemoteNetworkConfig{}
for _, remoteNetwork := range c.spec.RemoteNetworkConfig.RemotePodNetworks {
cluster.RemoteNetworkConfig.RemotePodNetworks = append(cluster.RemoteNetworkConfig.RemotePodNetworks, gfneks.RemoteNetworks{
CIDRs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
cluster.RemoteNetworkConfig.RemotePodNetworks = append(cluster.RemoteNetworkConfig.RemotePodNetworks, gfneks.Cluster_RemotePodNetwork{
Cidrs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
})
}
for _, remoteNetwork := range c.spec.RemoteNetworkConfig.RemoteNodeNetworks {
cluster.RemoteNetworkConfig.RemoteNodeNetworks = append(cluster.RemoteNetworkConfig.RemoteNodeNetworks, gfneks.RemoteNetworks{
CIDRs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
cluster.RemoteNetworkConfig.RemoteNodeNetworks = append(cluster.RemoteNetworkConfig.RemoteNodeNetworks, gfneks.Cluster_RemoteNodeNetwork{
Cidrs: gfnt.NewStringSlice(remoteNetwork.CIDRs...),
})
}
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/cfn/builder/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"strings"

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

Expand Down Expand Up @@ -145,12 +144,13 @@ func (c *ClusterResourceSet) addIAMRolesAnywhere() {
Enabled: gfnt.NewBoolean(true),
Name: makeName("CA"),
Source: &gfnrolesanywhere.TrustAnchor_Source{
SourceType: aws.String("CERTIFICATE_BUNDLE"),
SourceData: &gfnrolesanywhere.TrustAnchor_SourceData{
X509CertificateData: c.spec.RemoteNetworkConfig.IAM.CABundleCert,
},
SourceType: gfnt.NewString("CERTIFICATE_BUNDLE"),
SourceData: &gfnrolesanywhere.TrustAnchor_SourceData{},
},
}
if c.spec.RemoteNetworkConfig.IAM.CABundleCert != nil {
trustAnchor.Source.SourceData.X509CertificateData = gfnt.NewString(*c.spec.RemoteNetworkConfig.IAM.CABundleCert)
}
anywhereProfile := &gfnrolesanywhere.Profile{
Enabled: gfnt.NewBoolean(true),
Name: makeName("remote-nodes"),
Expand Down
12 changes: 10 additions & 2 deletions pkg/cfn/builder/managed_nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ func NewManagedNodeGroup(ec2API awsapi.EC2, cluster *api.ClusterConfig, nodeGrou
}
}

func convertToTypesValueMap(input map[string]string) map[string]*gfnt.Value {
output := make(map[string]*gfnt.Value)
for k, v := range input {
output[k] = gfnt.NewString(v)
}
return output
}

// AddAllResources adds all required CloudFormation resources
func (m *ManagedNodeGroupResourceSet) AddAllResources(ctx context.Context) error {
m.resourceSet.template.Description = fmt.Sprintf(
Expand Down Expand Up @@ -101,8 +109,8 @@ func (m *ManagedNodeGroupResourceSet) AddAllResources(ctx context.Context) error
ScalingConfig: &scalingConfig,
Subnets: subnets,
NodeRole: nodeRole,
Labels: m.nodeGroup.Labels,
Tags: m.nodeGroup.Tags,
Labels: convertToTypesValueMap(m.nodeGroup.Labels),
Tags: convertToTypesValueMap(m.nodeGroup.Tags),
Taints: taints,
}

Expand Down
65 changes: 60 additions & 5 deletions pkg/cfn/builder/testdata/custom_vpc_private_endpoint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.ec2",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointEC2"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
Expand All @@ -22,7 +33,18 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.ecr.api",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRAPI"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
Expand All @@ -35,16 +57,38 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.ecr.dkr",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRDKR"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
},
"VPCEndpointS3": {
"Type": "AWS::EC2::VPCEndpoint",
"Properties": {
"RouteTableIds": ["rtb-custom-1", "rtb-custom-2"],
"RouteTableIds": [
"rtb-custom-1",
"rtb-custom-2"
],
"ServiceName": "com.amazonaws.us-west-2.s3",
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointS3"
}
}
],
"VpcEndpointType": "Gateway",
"VpcId": "vpc-custom"
}
Expand All @@ -57,7 +101,18 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.sts",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointSTS"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.ec2",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointEC2"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
Expand All @@ -22,7 +33,18 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.ecr.api",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRAPI"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
Expand All @@ -35,16 +57,37 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.ecr.dkr",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRDKR"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
},
"VPCEndpointS3": {
"Type": "AWS::EC2::VPCEndpoint",
"Properties": {
"RouteTableIds": ["rtb-custom-1"],
"RouteTableIds": [
"rtb-custom-1"
],
"ServiceName": "com.amazonaws.us-west-2.s3",
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointS3"
}
}
],
"VpcEndpointType": "Gateway",
"VpcId": "vpc-custom"
}
Expand All @@ -57,7 +100,18 @@
"sg-test"
],
"ServiceName": "com.amazonaws.us-west-2.sts",
"SubnetIds": ["subnet-custom1", "subnet-custom2"],
"SubnetIds": [
"subnet-custom1",
"subnet-custom2"
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointSTS"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": "vpc-custom"
}
Expand Down
40 changes: 40 additions & 0 deletions pkg/cfn/builder/testdata/vpc_private.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@
"Ref": "SubnetPrivateUSWEST2C"
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointEC2"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": {
"Ref": "VPC"
Expand Down Expand Up @@ -260,6 +268,14 @@
"Ref": "SubnetPrivateUSWEST2D"
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRAPI"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": {
"Ref": "VPC"
Expand Down Expand Up @@ -288,6 +304,14 @@
"Ref": "SubnetPrivateUSWEST2D"
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointECRDKR"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": {
"Ref": "VPC"
Expand All @@ -312,6 +336,14 @@
}
],
"ServiceName": "com.amazonaws.us-west-2.s3",
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointS3"
}
}
],
"VpcEndpointType": "Gateway",
"VpcId": {
"Ref": "VPC"
Expand All @@ -337,6 +369,14 @@
"Ref": "SubnetPrivateUSWEST2C"
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "${AWS::StackName}/VPCEndpointSTS"
}
}
],
"VpcEndpointType": "Interface",
"VpcId": {
"Ref": "VPC"
Expand Down
Loading