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

Remove deprecated 'securityGroupId' property from createEC2InstanceInput #247

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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmd/egress/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type egressConfig struct {
vpcSubnetID string
cloudImageID string
instanceType string
securityGroupId string // Deprecated: prefer securityGroupIDs
securityGroupIDs []string
cloudTags map[string]string
debug bool
Expand Down Expand Up @@ -142,7 +141,6 @@ are set correctly before execution.
//Setup AWS Specific Configs
vei.AWS = verifier.AwsEgressConfig{
KmsKeyID: config.kmsKeyID,
SecurityGroupId: config.securityGroupId,
SecurityGroupIDs: config.securityGroupIDs,
}

Expand Down Expand Up @@ -239,7 +237,6 @@ are set correctly before execution.
validateEgressCmd.Flags().StringVar(&config.vpcSubnetID, "subnet-id", "", "source subnet ID")
validateEgressCmd.Flags().StringVar(&config.cloudImageID, "image-id", "", "(optional) cloud image for the compute instance")
validateEgressCmd.Flags().StringVar(&config.instanceType, "instance-type", "t3.micro", "(optional) compute instance type")
validateEgressCmd.Flags().StringVar(&config.securityGroupId, "security-group-id", "", "(deprecated in favor of --security-group-ids)")
validateEgressCmd.Flags().StringSliceVar(&config.securityGroupIDs, "security-group-ids", []string{}, "(optional) comma-separated list of sec. group IDs to attach to the created EC2 instance. If absent, one will be created")
validateEgressCmd.Flags().StringVar(&config.region, "region", "", fmt.Sprintf("(optional) compute instance region. If absent, environment var %[1]v = %[2]v and %[3]v = %[4]v will be used", awsRegionEnvVarStr, awsRegionDefault, gcpRegionEnvVarStr, gcpRegionDefault))
validateEgressCmd.Flags().StringToStringVar(&config.cloudTags, "cloud-tags", map[string]string{}, "(optional) comma-seperated list of tags to assign to cloud resources e.g. --cloud-tags key1=value1,key2=value2")
Expand All @@ -261,7 +258,5 @@ are set correctly before execution.
validateEgressCmd.PrintErr(err)
}

//Mark securityGroupId and securityGroupsIDs flags as mutually exclusive (one or the other should be passed, not both).
validateEgressCmd.MarkFlagsMutuallyExclusive("security-group-id", "security-group-ids")
return validateEgressCmd
}
7 changes: 0 additions & 7 deletions pkg/verifier/aws/aws_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ type createEC2InstanceInput struct {
SubnetID string
userdata string
KmsKeyID string
securityGroupId string // Deprecated: prefer securityGroupIDs
securityGroupIDs []string
tempSecurityGroupID string
instanceCount int32
Expand All @@ -181,12 +180,6 @@ func (a *AwsVerifier) createEC2Instance(input createEC2InstanceInput) (string, e
SubnetId: awsTools.String(input.SubnetID),
}

// An empty string does not default to the default security group, and returns this error:
// error performing ec2:RunInstances: Value () for parameter groupId is invalid. The value cannot be empty
if input.securityGroupId != "" {
eniSpecification.Groups = append(eniSpecification.Groups, input.securityGroupId)
}

if len(input.securityGroupIDs) > 0 {
eniSpecification.Groups = input.securityGroupIDs
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/verifier/aws/entry_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (a *AwsVerifier) ValidateEgress(vei verifier.ValidateEgressInput) *output.O
}

// If security group not given, create a temporary one
if vei.AWS.SecurityGroupId == "" && len(vei.AWS.SecurityGroupIDs) == 0 || vei.ForceTempSecurityGroup {
if len(vei.AWS.SecurityGroupIDs) == 0 || vei.ForceTempSecurityGroup {

createSecurityGroupOutput, err := a.CreateSecurityGroup(vei.Ctx, vei.Tags, "osd-network-verifier", vpcId)
if err != nil {
Expand Down Expand Up @@ -215,7 +215,6 @@ func (a *AwsVerifier) ValidateEgress(vei verifier.ValidateEgressInput) *output.O
ctx: vei.Ctx,
instanceType: vei.InstanceType,
tags: vei.Tags,
securityGroupId: vei.AWS.SecurityGroupId,
securityGroupIDs: vei.AWS.SecurityGroupIDs,
tempSecurityGroupID: vei.AWS.TempSecurityGroup,
keyPair: vei.ImportKeyPair,
Expand Down
1 change: 0 additions & 1 deletion pkg/verifier/package_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type ValidateEgressInput struct {
}
type AwsEgressConfig struct {
KmsKeyID string
SecurityGroupId string // Deprecated: prefer securityGroupIDs
SecurityGroupIDs []string
TempSecurityGroup string
}
Expand Down