func (b *FirewallModelBuilder) addNodePortRules(c *fi.ModelBuilderContext, sgMap map[string]*openstacktasks.SecurityGroup) error {

	nodeName := b.SecurityGroupName(kops.InstanceGroupRoleNode)
	nodeSG := sgMap[nodeName]

	for _, nodePortAccess := range b.Cluster.Spec.NodePortAccess {

		nodePortRange, err := b.NodePortRange()
		if err != nil {
			return err
		}

		for _, protocol := range []string{IPProtocolTCP, IPProtocolUDP} {
			nodePortRule := &openstacktasks.SecurityGroupRule{
				Lifecycle:      b.Lifecycle,
				Direction:      s(string(rules.DirIngress)),
				Protocol:       s(protocol),
				EtherType:      s(IPV4),
				PortRangeMin:   i(nodePortRange.Base),
				PortRangeMax:   i(nodePortRange.Base + nodePortRange.Size - 1),
				RemoteIPPrefix: s(nodePortAccess),
			}
			addDirectionalGroupRule(c, nodeSG, nil, nodePortRule)
		}
	}
	return nil
}
// addNodePortRules - Add node port rules to nodes give the NodePortRange
Add node port rules to nodes give the NodePortRange
// addNodePortRules - Add node port rules to nodes give the NodePortRange
func (b *FirewallModelBuilder) addNodePortRules(c *fi.ModelBuilderContext, sgMap map[string]*openstacktasks.SecurityGroup) error {
	nodeName := b.SecurityGroupName(kops.InstanceGroupRoleNode)
	nodeSG := sgMap[nodeName]
	for _, nodePortAccess := range b.Cluster.Spec.NodePortAccess {
		nodePortRange, err := b.NodePortRange()
		if err != nil {
			return err
		}
		for _, protocol := range []string{IPProtocolTCP, IPProtocolUDP} {
			nodePortRule := &openstacktasks.SecurityGroupRule{
				Lifecycle:      b.Lifecycle,
				Direction:      s(string(rules.DirIngress)),
				Protocol:       s(protocol),
				EtherType:      s(IPV4),
				PortRangeMin:   i(nodePortRange.Base),
				PortRangeMax:   i(nodePortRange.Base + nodePortRange.Size - 1),
				RemoteIPPrefix: s(nodePortAccess),
			}
			addDirectionalGroupRule(c, nodeSG, nil, nodePortRule)
		}
	}
	return nil
}
func ( b * FirewallModelBuilder ) addNodePortRules ( c * fi . ModelBuilderContext , sgMap map [ string ] * openstacktasks . SecurityGroup ) error { nodeName := b . SecurityGroupName ( kops . InstanceGroupRoleNode ) nodeSG := sgMap [ nodeName ] for _ , nodePortAccess := range b . Cluster . Spec . NodePortAccess { nodePortRange , err := b . NodePortRange ( ) if err != nil { return err } for _ , protocol := range [ ] string { IPProtocolTCP , IPProtocolUDP } { nodePortRule := & openstacktasks . SecurityGroupRule { Lifecycle : b . Lifecycle , Direction : s ( string ( rules . DirIngress ) ) , Protocol : s ( protocol ) , EtherType : s ( IPV4 ) , PortRangeMin : i ( nodePortRange . Base ) , PortRangeMax : i ( nodePortRange . Base + nodePortRange . Size - 1 ) , RemoteIPPrefix : s ( nodePortAccess ) , } addDirectionalGroupRule ( c , nodeSG , nil , nodePortRule ) } } return nil }
Add node port rules to nodes give the NodePortRange
Add node port rules to nodes give the NodePortRange