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

Consistent naming of security group rules #10179

Merged
merged 2 commits into from
Nov 7, 2020

Conversation

olemarkus
Copy link
Member

In order to let kops fully control the rules for each security group we need to be able to generate names from the info in AWS. This is similar to the approach we used for openstack.

This only converts the naming of some of the rules. Since this affects CF/TF resource names, I want to make sure this doesn't cause any concerns.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 6, 2020
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 6, 2020
@olemarkus
Copy link
Member Author

/cc @rifelpet

}

if o.Protocol == nil || fi.StringValue(o.Protocol) == "" {
proto = "AllProtos"
Copy link
Member

Choose a reason for hiding this comment

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

Should be enough to say "all".

Suggested change
proto = "AllProtos"
proto = "all"

Copy link
Member Author

Choose a reason for hiding this comment

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

all what? :) I used allprotos because for descriptiveness when one reads the names in tasks, logs etc.
But I don't have a strong opinion.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it could be replaced with a - or something else, but the location will be used for protocol everywhere.

Comment on lines 444 to 445
return fmt.Sprintf("%v-%v-from-%v-to-%v-%v-%v", direction,
proto, src, dst, fi.Int64Value(o.FromPort), fi.Int64Value(o.ToPort))
Copy link
Member

Choose a reason for hiding this comment

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

Any special reason for using "%v"?

Suggested change
return fmt.Sprintf("%v-%v-from-%v-to-%v-%v-%v", direction,
proto, src, dst, fi.Int64Value(o.FromPort), fi.Int64Value(o.ToPort))
return fmt.Sprintf("%s-%s-%d-%d-from-%s-to-%s", direction,
proto, fi.Int64Value(o.FromPort), fi.Int64Value(o.ToPort), src, dst)

Copy link
Member

Choose a reason for hiding this comment

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

When we have Ingress, do we still need To, or is it intended that it refers to current SG?
Same for Egress and From.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to mention both src and dst to avoid duplications. or are you referring to the word "from" itself?

In order to let kops fully control the rules for each security group we need to be able to generate names from the info in AWS. This is similar to the approach we used for openstack

Update pkg/model/firewall.go

Co-authored-by: Ciprian Hacman <ciprianhacman@gmail.com>
@hakman
Copy link
Member

hakman commented Nov 7, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hakman, olemarkus

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 7, 2020
@k8s-ci-robot k8s-ci-robot merged commit 6a57543 into kubernetes:master Nov 7, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Nov 7, 2020
@rifelpet
Copy link
Member

rifelpet commented Nov 7, 2020

I think this renaming could result in short periods of connectivity loss. We could add another release note with the 'terraform state mv' commands to make terraform report a no-op.

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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants