Skip to content

Commit

Permalink
Add comments and function renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreya Anil Naik committed Feb 2, 2022
1 parent ba8851e commit fa4f247
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions test/framework/resources/aws/services/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

type EKS interface {
DescribeCluster(clusterName string) (*eks.DescribeClusterOutput, error)
CreateAddon(createAddOnParams CreateAddOnParams) (*eks.CreateAddonOutput, error)
CreateAddon(createAddOnParams AddOnInput) (*eks.CreateAddonOutput, error)
DeleteAddon(addon string, clusterName string) (*eks.DeleteAddonOutput, error)
DescribeAddonVersions(addon string, k8sVersion string) (*eks.DescribeAddonVersionsOutput, error)
DescribeAddon(addon string, clusterName string) (*eks.DescribeAddonOutput, error)
Expand All @@ -32,12 +32,13 @@ type defaultEKS struct {
eksiface.EKSAPI
}

type CreateAddOnParams struct {
// struct added to make params passing extensible
type AddOnInput struct {
_ struct{} `type:"structure"`

AddonName string `locationName:"addonName" type:"string" required:"true"`
ClusterName string `location:"uri" locationName:"name" min:"1" type:"string" required:"true"`
AddonVersion string `locationName:"addonVersion" type:"string"`
AddonVersion string `locationName:"addonVersion" type:"string"` // eg format: v1.9.3-eksbuild.1
}

func NewEKS(session *session.Session, endpoint string) EKS {
Expand All @@ -49,13 +50,13 @@ func NewEKS(session *session.Session, endpoint string) EKS {
}
}

func (d defaultEKS) CreateAddon(createAddOnParams CreateAddOnParams) (*eks.CreateAddonOutput, error) {
func (d defaultEKS) CreateAddon(addOnInput AddOnInput) (*eks.CreateAddonOutput, error) {
createAddonInput := &eks.CreateAddonInput{
AddonName: aws.String(createAddOnParams.AddonName),
ClusterName: aws.String(createAddOnParams.ClusterName),
AddonName: aws.String(addOnInput.AddonName),
ClusterName: aws.String(addOnInput.ClusterName),
}
if createAddOnParams.AddonVersion != "" {
createAddonInput.SetAddonVersion(createAddOnParams.AddonVersion)
if addOnInput.AddonVersion != "" {
createAddonInput.SetAddonVersion(addOnInput.AddonVersion)
createAddonInput.SetResolveConflicts("OVERWRITE")
}
return d.EKSAPI.CreateAddon(createAddonInput)
Expand Down
4 changes: 2 additions & 2 deletions test/integration-new/cni/cni_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ func ApplyAddOn(versionName string) {
}

By("apply addon version")
_, err = f.CloudServices.EKS().CreateAddon(services.CreateAddOnParams{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName})
_, err = f.CloudServices.EKS().CreateAddon(services.AddOnInput{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName})
Expect(err).ToNot(HaveOccurred())

}
} else {
fmt.Printf("By applying addon %s\n", versionName)
By("apply addon version")
_, err = f.CloudServices.EKS().CreateAddon(services.CreateAddOnParams{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName})
_, err = f.CloudServices.EKS().CreateAddon(services.AddOnInput{AddonName: "vpc-cni", ClusterName: f.Options.ClusterName, AddonVersion: versionName})
Expect(err).ToNot(HaveOccurred())
}

Expand Down
2 changes: 1 addition & 1 deletion test/integration-new/ipamd/ipamd_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var _ = BeforeSuite(func() {
var _ = AfterSuite(func() {
if addonDeleteError == nil {
By("Restore coredns addon")
_, err := f.CloudServices.EKS().CreateAddon(services.CreateAddOnParams{AddonName: "coredns", ClusterName: f.Options.ClusterName})
_, err := f.CloudServices.EKS().CreateAddon(services.AddOnInput{AddonName: "coredns", ClusterName: f.Options.ClusterName})
Expect(err).NotTo(HaveOccurred())
}
})

0 comments on commit fa4f247

Please sign in to comment.