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

resources: Add SecurityGroup resource #97

Merged
merged 1 commit into from Apr 5, 2017

Conversation

nhlfr
Copy link

@nhlfr nhlfr commented Apr 5, 2017

Security groups are needed both for VPCs and ELBs. Both of them will use this resource.

Ref #27
Ref #69

// Insecure apiserver
80,
// apiserver
443,
Copy link
Contributor

Choose a reason for hiding this comment

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

We were using 6443 in #70, and that's what I see elsewhere too. Which is it?

Copy link
Author

Choose a reason for hiding this comment

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

Using 6443 was a temporary solution for #70 which IMO should be disregarded, but I wasn't aware that kubernetesd is using that too. Will add it.

Copy link
Author

Choose a reason for hiding this comment

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

Done (it means, I included both 443 and 6443, just in case)

Copy link
Contributor

Choose a reason for hiding this comment

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

We have these ports in the TPR, no? Does it make sense to use those?

Copy link
Author

Choose a reason for hiding this comment

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

Not all of them, but probably everything except SSH. I can use what is available in TPR.

Copy link
Author

Choose a reason for hiding this comment

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

done

Description string
GroupName string
VpcID string
name string
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we call this id, since it contains the groupID?

Copy link
Author

Choose a reason for hiding this comment

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

Then I need to create another interface, but OK, can do.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not the most important thing

func (s *SecurityGroup) openPort(port int) error {
if _, err := s.Clients.EC2.AuthorizeSecurityGroupIngress(&ec2.AuthorizeSecurityGroupIngressInput{
CidrIp: aws.String("0.0.0.0/0"),
GroupId: aws.String(s.Name()),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be name()

Copy link
Author

Choose a reason for hiding this comment

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

No, name is a private field, Name is a public method.

if _, err := s.Clients.EC2.AuthorizeSecurityGroupIngress(&ec2.AuthorizeSecurityGroupIngressInput{
CidrIp: aws.String("0.0.0.0/0"),
GroupId: aws.String(s.Name()),
IpProtocol: aws.String("tcp"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer if this was capitalized.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

😢


func (s *SecurityGroup) openPort(port int) error {
if _, err := s.Clients.EC2.AuthorizeSecurityGroupIngress(&ec2.AuthorizeSecurityGroupIngressInput{
CidrIp: aws.String("0.0.0.0/0"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what you're doing here is allowing inbound connections on those ports from any IP. Do we want to be so permissive?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. What alse do you suggest? Maybe we could make it configurable, but IMO it's too early for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we leave it like this then we should definitely add an issue to remember to change it in the future.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I can create it

Copy link
Contributor

Choose a reason for hiding this comment

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

My gut feeling is that this is too open, but I'm not certain what would improve the situation. Issue is fine with me.

}

func (s *SecurityGroup) Delete() error {
return microerror.MaskAny(notImplementedMethodError)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we implement this instead? :)

Copy link
Author

Choose a reason for hiding this comment

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

Sure, can do

Copy link
Author

Choose a reason for hiding this comment

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

done

@nhlfr nhlfr force-pushed the nhlfr/security-group branch 2 times, most recently from 0578682 to 16fa4c3 Compare April 5, 2017 13:00
)

var (
portsToOpen []int = []int{
Copy link
Contributor

Choose a reason for hiding this comment

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

I get a linter warning here saying you can omit the []int on the LHS.

Copy link
Author

Choose a reason for hiding this comment

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

done

@nhlfr nhlfr force-pushed the nhlfr/security-group branch 3 times, most recently from cbcef1a to e67002c Compare April 5, 2017 14:30
Description string
GroupName string
VpcID string
Cluster clustertpr.Cluster
Copy link
Contributor

@asymmetric asymmetric Apr 5, 2017

Choose a reason for hiding this comment

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

I'm not so sure this type needs to have access to the whole cluster part of the TPR. I think a list of port would make more sense.

But I understand that this could be a compromise to get us running. In that case though, we should address this later and have an issue to track it.

Copy link
Author

Choose a reason for hiding this comment

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

Where do you want to create that list of ports, in which function and module, and based on what input?

Copy link
Contributor

Choose a reason for hiding this comment

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

  • Where you create the struct (in our case, service.go)
  • Based on the TPR

I'm just advocating for separating concerns.

Copy link
Contributor

Choose a reason for hiding this comment

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

But yeah, it's not the most pressing concern, so you're also free to disregard :)

Copy link
Author

Choose a reason for hiding this comment

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

You convinced me, done

Security groups are needed both for VPCs and ELBs. Both of
them will use this resource.

Ref giantswarm#27
Ref giantswarm#69
@asymmetric
Copy link
Contributor

Please also create the issue wrt IP addresses.

@nhlfr nhlfr merged commit 6a43dbc into giantswarm:master Apr 5, 2017
@nhlfr nhlfr deleted the nhlfr/security-group branch April 5, 2017 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants