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

Spotinst: Attempt to find a Security Group even without a VPC ID #6030

Merged
merged 2 commits into from
Nov 8, 2018

Conversation

liranp
Copy link
Contributor

@liranp liranp commented Nov 1, 2018

Specifying additional security groups in the InstanceGroup's spec resulted in a spurious change. This happens because of an incorrect value (nil, actually) returns from this function, although there is no reason for it to be done this way since the VPC ID is only used in L115.

This PR eliminates ths spurious change by allowing the find function to be executed even without a VPC ID.

Steps to reproduce

  1. Edit the instance group by adding an additional security group:
apiVersion: kops/v1alpha2
kind: InstanceGroup
spec:
  additionalSecurityGroups:
  - sg-<REDACTED#2>
  1. Update the cluster. In the logs you'll see thw following change:
Elastigroup/nodes.<cluster_name>
        SecurityGroups           [name:nodes.<cluster_name> id:sg-<REDACTED#1>] -> [name:nodes.<cluster_name> id:sg-<REDACTED#1>, name:sg-<REDACTED#2> id:sg-<REDACTED#2>]
  1. Update the cluster once again and you'll see the same output, which is a result of a spurious change.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 1, 2018
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 1, 2018
request.GroupIds = []*string{e.ID}
} else {

} else if fi.StringValue(e.Name) != "" && e.VPC != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

The lines removed above were also validating that e.VPC.ID is not null. Was this an invalid case, or do you need to extend your if check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KashifSaadat Thanks! Good catch, fixed.

@KashifSaadat
Copy link
Contributor

Hey @liranp, thanks for the contribution :) Just one small query I added, otherwise the change looks good.

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 5, 2018
@KashifSaadat
Copy link
Contributor

Great, thanks @liranp !

/ok-to-test
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Nov 8, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KashifSaadat, liranp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 8, 2018
@k8s-ci-robot k8s-ci-robot merged commit 1c3acbe into kubernetes:master Nov 8, 2018
@liranp liranp deleted the fix-aws-sg-find branch May 5, 2019 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants