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

Awscapi #342

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ build-e2e:

.PHONY: test-e2e
test-e2e: ## Run openshift specific e2e test
hack/ci-integration.sh $(GINKGO_ARGS) --label-filter='!periodic' -p
hack/ci-integration.sh $(GINKGO_ARGS) --label-filter='!periodic&&!qe-account-only' -p

.PHONY: test-e2e-periodic
test-e2e-periodic: ## Run openshift specific periodic e2e test
hack/ci-integration.sh $(GINKGO_ARGS) --label-filter=periodic -p
hack/ci-integration.sh $(GINKGO_ARGS) --label-filter='periodic&&!qe-account-only' -p

.PHONY: help
help:
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/onsi/ginkgo/v2 v2.20.2
github.com/onsi/gomega v1.34.2
github.com/openshift/api v0.0.0-20240924155631-232984653385
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241112115249-e541d71175dd
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241119145735-af0b63d8343b
github.com/openshift/cluster-autoscaler-operator v0.0.1-0.20240509123215-40cadf8a4729
github.com/openshift/library-go v0.0.0-20240919205913-c96b82b3762b
github.com/openshift/machine-api-operator v0.2.1-0.20240924183942-9c3e4a04009a
Expand All @@ -22,6 +22,7 @@ require (
k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
sigs.k8s.io/cluster-api v1.8.4
sigs.k8s.io/cluster-api-provider-aws/v2 v2.6.1
sigs.k8s.io/cluster-api-provider-azure v1.17.1
sigs.k8s.io/controller-runtime v0.19.0
sigs.k8s.io/yaml v1.4.0
Expand Down Expand Up @@ -125,7 +126,7 @@ require (
github.com/gostaticanalysis/comment v1.4.2 // indirect
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
Expand Down
16 changes: 10 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
Expand Down Expand Up @@ -275,8 +277,8 @@ github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW
github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M=
github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY=
github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc h1:f8eY6cV/x1x+HLjOp4r72s/31/V2aTUtg5oKRRPf8/Q=
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
Expand Down Expand Up @@ -403,8 +405,8 @@ github.com/openshift/api v0.0.0-20240924155631-232984653385 h1:P6O191HwBj0ahEfea
github.com/openshift/api v0.0.0-20240924155631-232984653385/go.mod h1:OOh6Qopf21pSzqNVCB5gomomBXb8o5sGKZxG2KNpaXM=
github.com/openshift/client-go v0.0.0-20240918182115-6a8ead8397fd h1:Gd0+bYdcfGIsDOJ8BwTJJjQeXoziyIsTwqp/s38rKyM=
github.com/openshift/client-go v0.0.0-20240918182115-6a8ead8397fd/go.mod h1:EB7GeA/vpf9AHklMgnnT0+uG6l/3f8cChtCFbJFrk4g=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241112115249-e541d71175dd h1:drEJQPJXOH36XivQ2d1gMrRzZzY4rOwfU939lYU0lEQ=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241112115249-e541d71175dd/go.mod h1:Ns6d57JhMddy6w5c61HHWQ4jqF8Pvrv8mgs2gxg5jKU=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241119145735-af0b63d8343b h1:/WI6qAWsweZAXn/mRsbNbUrQqQlgUxGbAgFowq13UUc=
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241119145735-af0b63d8343b/go.mod h1:Ns6d57JhMddy6w5c61HHWQ4jqF8Pvrv8mgs2gxg5jKU=
github.com/openshift/cluster-autoscaler-operator v0.0.1-0.20240509123215-40cadf8a4729 h1:SNWwFZ+lMj5LGX99SRbQHafgxLcSOv5JCeBdY6OY/PE=
github.com/openshift/cluster-autoscaler-operator v0.0.1-0.20240509123215-40cadf8a4729/go.mod h1:AJ4/7eaCOr6GtNSv3CvQVRVNlqUINm0Qm9IzatXx4dY=
github.com/openshift/cluster-control-plane-machine-set-operator v0.0.0-20240909043600-373ac49835bf h1:mfMmaD9+vZIZQq3MGXsS/AGHXekj4wIn3zc1Cs1EY8M=
Expand Down Expand Up @@ -479,8 +481,8 @@ github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32Zrusyu
github.com/sashamelentyev/usestdlibvars v1.27.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8=
github.com/securego/gosec/v2 v2.21.2 h1:deZp5zmYf3TWwU7A7cR2+SolbTpZ3HQiwFqnzQyEl3M=
github.com/securego/gosec/v2 v2.21.2/go.mod h1:au33kg78rNseF5PwPnTWhuYBFf534bvJRvOrgZ/bFzU=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
Expand Down Expand Up @@ -808,6 +810,8 @@ mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ=
sigs.k8s.io/cluster-api v1.8.4 h1:jBKQH1H/HUdUFk8T6qDzIxZJfWw1F5ZP0ZpYQJDmTHs=
sigs.k8s.io/cluster-api v1.8.4/go.mod h1:pXv5LqLxuIbhGIXykyNKiJh+KrLweSBajVHHitPLyoY=
sigs.k8s.io/cluster-api-provider-aws/v2 v2.6.1 h1:vbZUYEB7OfPlfHk6wis+UrvRLTqv5F4Nrjl2WDJ1kiw=
sigs.k8s.io/cluster-api-provider-aws/v2 v2.6.1/go.mod h1:1aq1EZbirRW6NC2gYUFCc7cVFwX9PM/vDvoU+2oGPuw=
sigs.k8s.io/cluster-api-provider-azure v1.17.1 h1:f1sTGfv6hAN9WrxeawE4pQ2nRhEKb7AJjH6MhU/wAzg=
sigs.k8s.io/cluster-api-provider-azure v1.17.1/go.mod h1:16VtsvIpK8qtNHplG2ZHZ74/JKTzOUQIAWWutjnpvEc=
sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q=
Expand Down
239 changes: 239 additions & 0 deletions pkg/capi/aws.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
package capi

import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
configv1 "github.com/openshift/api/config/v1"
mapiv1 "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/cluster-api-actuator-pkg/pkg/framework"
"github.com/openshift/cluster-api-actuator-pkg/pkg/framework/gatherer"
capiinfrastructurev1beta2resourcebuilder "github.com/openshift/cluster-api-actuator-pkg/testutils/resourcebuilder/cluster-api/infrastructure/v1beta2"
corev1 "k8s.io/api/core/v1"
awsv1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

"sigs.k8s.io/controller-runtime/pkg/client/config"

"sigs.k8s.io/controller-runtime/pkg/client"
yaml "sigs.k8s.io/yaml"
)

const (
awsMachineTemplateName = "aws-machine-template"
infrastructureName = "cluster"
infraAPIVersion = "infrastructure.cluster.x-k8s.io/v1beta1"
)

var _ = Describe("Cluster API AWS MachineSet", framework.LabelCAPI, framework.LabelDisruptive, Ordered, func() {
var (
cl client.Client
ctx = context.Background()
platform configv1.PlatformType
clusterName string
oc *gatherer.CLI
awsMachineTemplate *awsv1.AWSMachineTemplate
machineSetParams framework.CAPIMachineSetParams
machineSet *clusterv1.MachineSet
mapiDefaultProviderSpec *mapiv1.AWSMachineProviderConfig
err error
)

BeforeAll(func() {
cfg, err := config.GetConfig()
Expect(err).ToNot(HaveOccurred(), "Failed to GetConfig")

cl, err = client.New(cfg, client.Options{})
Expect(err).ToNot(HaveOccurred(), "Failed to create Kubernetes client for test")

infra := &configv1.Infrastructure{}
infraName := client.ObjectKey{
Name: infrastructureName,
}
Expect(cl.Get(ctx, infraName, infra)).To(Succeed(), "Failed to get cluster infrastructure object")
Expect(infra.Status.PlatformStatus).ToNot(BeNil(), "expected the infrastructure Status.PlatformStatus to not be nil")
clusterName = infra.Status.InfrastructureName
platform = infra.Status.PlatformStatus.Type
if platform != configv1.AWSPlatformType {
Skip("Skipping AWS E2E tests")
}
oc, err = framework.NewCLI()
Expect(err).ToNot(HaveOccurred(), "Failed to new CLI")
framework.SkipIfNotTechPreviewNoUpgrade(oc, cl)
_, mapiDefaultProviderSpec = getDefaultAWSMAPIProviderSpec(cl)
machineSetParams = framework.NewCAPIMachineSetParams(
"aws-machineset",
clusterName,
mapiDefaultProviderSpec.Placement.AvailabilityZone,
1,
corev1.ObjectReference{
Kind: "AWSMachineTemplate",
APIVersion: infraAPIVersion,
Name: awsMachineTemplateName,
},
)
framework.CreateCoreCluster(ctx, cl, clusterName, "AWSCluster")
})

AfterEach(func() {
framework.DeleteCAPIMachineSets(ctx, cl, machineSet)
framework.WaitForCAPIMachineSetsDeleted(ctx, cl, machineSet)
framework.DeleteObjects(ctx, cl, awsMachineTemplate)
})

//huliu-OCP-51071 - [CAPI] Create machineset with CAPI on aws
It("should be able to run a machine with a default provider spec", func() {
awsMachineTemplate = newAWSMachineTemplate(mapiDefaultProviderSpec)
Expect(cl.Create(ctx, awsMachineTemplate)).To(Succeed(), "Failed to create awsmachinetemplate")
machineSetParams = framework.UpdateCAPIMachineSetName("aws-machineset-51071", machineSetParams)
machineSet, err = framework.CreateCAPIMachineSet(ctx, cl, machineSetParams)
Expect(err).ToNot(HaveOccurred(), "Failed to create CAPI machineset")
framework.WaitForCAPIMachinesRunning(ctx, cl, machineSet.Name)
})

//huliu-OCP-75395 - [CAPI] AWS Placement group support.
It("should be able to run a machine with cluster placement group", func() {
awsClient := framework.NewAwsClient(framework.GetCredentialsFromCluster(oc))
placementGroupName := clusterName + "pgcluster"
placementGroupID, err := awsClient.CreatePlacementGroup(placementGroupName, "cluster")
Expect(err).ToNot(HaveOccurred(), "Failed to create placementgroup")
Expect(placementGroupID).ToNot(Equal(""), "expected the placementGroupID to not be empty string")
DeferCleanup(func() {
_, err = awsClient.DeletePlacementGroup(placementGroupName)
Expect(err).ToNot(HaveOccurred(), "Failed to delete placementgroup")
})

awsMachineTemplate = newAWSMachineTemplate(mapiDefaultProviderSpec)
awsMachineTemplate.Spec.Template.Spec.PlacementGroupName = placementGroupName
Expect(cl.Create(ctx, awsMachineTemplate)).To(Succeed(), "Failed to create awsmachinetemplate")
machineSetParams = framework.UpdateCAPIMachineSetName("aws-machineset-75395", machineSetParams)
machineSet, err = framework.CreateCAPIMachineSet(ctx, cl, machineSetParams)
Expect(err).ToNot(HaveOccurred(), "Failed to create CAPI machineset")
framework.WaitForCAPIMachinesRunning(ctx, cl, machineSet.Name)
})

//huliu-OCP-75396 - [CAPI] Creating machines using KMS keys from AWS.
It("should be able to run a machine using KMS keys", framework.LabelQeAccountOnly, func() {
awsMachineTemplate = newAWSMachineTemplate(mapiDefaultProviderSpec)
region := mapiDefaultProviderSpec.Placement.Region
if region != "us-east-1" && region != "us-east-2" {
Skip("Region is " + region + ", skip this test scenario because we only created kms key in us-east-1/us-east-2 region")
}
var key string
switch region {
case "us-east-1":
key = "arn:aws:kms:us-east-1:301721915996:key/c471ec83-cfaf-41a2-9241-d9e99c4da344"
case "us-east-2":
key = "arn:aws:kms:us-east-2:301721915996:key/c228ef83-df2c-4151-84c4-d9f39f39a972"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be ran in dev's account?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the job result, and yes, you are right, this cannot be ran in dev's account, I just comment this case out for now and think of how to deal with it, will update in a following pr. Thank you @sunzhaohua2 PTAL again, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this case to skip it in dev's account.

}
awskmsClient := framework.NewAwsKmsClient(framework.GetCredentialsFromCluster(oc))
_, err = awskmsClient.DescribeKeyByID(key)
Expect(err).ToNot(HaveOccurred(), "Failed to get the key")
encryptBool := true
awsMachineTemplate.Spec.Template.Spec.NonRootVolumes = []awsv1.Volume{
{
DeviceName: "/dev/xvda",
Size: 140,
Type: awsv1.VolumeTypeIO1,
IOPS: 5000,
Encrypted: &encryptBool,
EncryptionKey: key,
},
}
Expect(cl.Create(ctx, awsMachineTemplate)).To(Succeed(), "Failed to create awsmachinetemplate")
machineSetParams = framework.UpdateCAPIMachineSetName("aws-machineset-75396", machineSetParams)
machineSet, err = framework.CreateCAPIMachineSet(ctx, cl, machineSetParams)
Expect(err).ToNot(HaveOccurred(), "Failed to create CAPI machineset")
framework.WaitForCAPIMachinesRunning(ctx, cl, machineSet.Name)
})
})

func getDefaultAWSMAPIProviderSpec(cl client.Client) (*mapiv1.MachineSet, *mapiv1.AWSMachineProviderConfig) {
machineSetList := &mapiv1.MachineSetList{}

Eventually(func() error {
return cl.List(framework.GetContext(), machineSetList, client.InNamespace(framework.MachineAPINamespace))
}, framework.WaitShort, framework.RetryShort).Should(Succeed(), "it should be able to list the MAPI machinesets")
Expect(machineSetList.Items).ToNot(HaveLen(0), "expected the MAPI machinesets to be present")

machineSet := &machineSetList.Items[0]
Expect(machineSet.Spec.Template.Spec.ProviderSpec.Value).ToNot(BeNil(), "expected the MAPI machinesets ProviderSpec value to not be nil")

providerSpec := &mapiv1.AWSMachineProviderConfig{}
Expect(yaml.Unmarshal(machineSet.Spec.Template.Spec.ProviderSpec.Value.Raw, providerSpec)).To(Succeed(), "it should be able to unmarshal the raw yaml into providerSpec")

return machineSet, providerSpec
}

func newAWSMachineTemplate(mapiProviderSpec *mapiv1.AWSMachineProviderConfig) *awsv1.AWSMachineTemplate {
By("Creating AWS machine template")

Expect(mapiProviderSpec).ToNot(BeNil(), "expected the mapi ProviderSpec to not be nil")
Expect(mapiProviderSpec.IAMInstanceProfile).ToNot(BeNil(), "expected the mapi IAMInstanceProfile to not be nil")
Expect(mapiProviderSpec.IAMInstanceProfile.ID).ToNot(BeNil(), "expected the mapi IAMInstanceProfile.ID to not be nil")
Expect(mapiProviderSpec.InstanceType).ToNot(BeEmpty(), "expected the mapi InstanceType to not be empty")
Expect(mapiProviderSpec.Placement.AvailabilityZone).ToNot(BeEmpty(), "expected the mapi Placement.AvailabilityZone to not be empty")
Expect(mapiProviderSpec.AMI.ID).ToNot(BeNil(), "expected the mapi AMI.ID to not be nil")
Expect(mapiProviderSpec.SecurityGroups).ToNot(HaveLen(0), "expected the mapi SecurityGroups to be present")
Expect(mapiProviderSpec.SecurityGroups[0].Filters).ToNot(HaveLen(0), "expected the mapi SecurityGroups[0].Filters to be present")
Expect(mapiProviderSpec.SecurityGroups[0].Filters[0].Values).ToNot(HaveLen(0), "expected the mapi SecurityGroups[0].Filters[0].Values to be present")

var subnet awsv1.AWSResourceReference

if len(mapiProviderSpec.Subnet.Filters) == 0 {
subnet = awsv1.AWSResourceReference{
ID: mapiProviderSpec.Subnet.ID,
}
} else {
subnet = awsv1.AWSResourceReference{
Filters: []awsv1.Filter{
{
Name: "tag:Name",
Values: mapiProviderSpec.Subnet.Filters[0].Values,
},
},
}
}

uncompressedUserData := true
ami := awsv1.AMIReference{
ID: mapiProviderSpec.AMI.ID,
}
ignition := &awsv1.Ignition{
Version: "3.4",
StorageType: awsv1.IgnitionStorageTypeOptionUnencryptedUserData,
}
additionalSecurityGroups := []awsv1.AWSResourceReference{
{
Filters: []awsv1.Filter{
{
Name: "tag:Name",
Values: mapiProviderSpec.SecurityGroups[0].Filters[0].Values,
},
},
},
{
Filters: []awsv1.Filter{
{
Name: "tag:Name",
Values: mapiProviderSpec.SecurityGroups[1].Filters[0].Values,
},
},
},
}
awsmt := capiinfrastructurev1beta2resourcebuilder.
AWSMachineTemplate().
WithUncompressedUserData(uncompressedUserData).
WithIAMInstanceProfile(*mapiProviderSpec.IAMInstanceProfile.ID).
WithInstanceType(mapiProviderSpec.InstanceType).
WithAMI(ami).
WithIgnition(ignition).
WithSubnet(&subnet).
WithAdditionalSecurityGroups(additionalSecurityGroups).
WithName(awsMachineTemplateName).
WithNamespace(framework.ClusterAPINamespace).
Build()

return awsmt
}
5 changes: 5 additions & 0 deletions pkg/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
machinev1 "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/cluster-api-actuator-pkg/pkg/framework"
caov1alpha1 "github.com/openshift/cluster-autoscaler-operator/pkg/apis"
awsv1 "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
azurev1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

Expand Down Expand Up @@ -48,6 +49,10 @@ func init() {
if err := azurev1.AddToScheme(scheme.Scheme); err != nil {
klog.Fatal(err)
}

if err := awsv1.AddToScheme(scheme.Scheme); err != nil {
klog.Fatal(err)
}
}

func TestE2E(t *testing.T) {
Expand Down
Loading