Skip to content

Commit

Permalink
Merge pull request #6944 from zetaab/allow_node_exporter
Browse files Browse the repository at this point in the history
add node-exporter to allowed ports
  • Loading branch information
k8s-ci-robot authored May 14, 2019
2 parents c9d3cbc + 5383463 commit f2bd5a5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/model/openstackmodel/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,26 @@ func (b *FirewallModelBuilder) addKubeletRules(c *fi.ModelBuilderContext, sgMap
return nil
}

// addNodeExporterRules - Allow 9100 TCP port from nodesg
func (b *FirewallModelBuilder) addNodeExporterRules(c *fi.ModelBuilderContext, sgMap map[string]*openstacktasks.SecurityGroup) error {
masterName := b.SecurityGroupName(kops.InstanceGroupRoleMaster)
nodeName := b.SecurityGroupName(kops.InstanceGroupRoleNode)
masterSG := sgMap[masterName]
nodeSG := sgMap[nodeName]
nodeExporterIngress := &openstacktasks.SecurityGroupRule{
Lifecycle: b.Lifecycle,
Direction: s(string(rules.DirIngress)),
Protocol: s(IPProtocolTCP),
EtherType: s(IPV4),
PortRangeMin: i(9100),
PortRangeMax: i(9100),
}
// allow 9100 port from nodeSG
addDirectionalGroupRule(c, masterSG, nodeSG, nodeExporterIngress)
addDirectionalGroupRule(c, nodeSG, nodeSG, nodeExporterIngress)
return nil
}

// addDNSRules - Add DNS rules for internal DNS queries
func (b *FirewallModelBuilder) addDNSRules(c *fi.ModelBuilderContext, sgMap map[string]*openstacktasks.SecurityGroup) error {

Expand Down Expand Up @@ -471,6 +491,8 @@ func (b *FirewallModelBuilder) Build(c *fi.ModelBuilderContext) error {
b.addDNSRules(c, sgMap)
//Add Kubelet Rules
b.addKubeletRules(c, sgMap)
//Add Node exporter Rules
b.addNodeExporterRules(c, sgMap)
// Protokube Rules
b.addProtokubeRules(c, sgMap)
//Allow necessary local traffic
Expand Down

0 comments on commit f2bd5a5

Please sign in to comment.