@@ -22,6 +22,7 @@ import (
2222
2323 "golang.org/x/exp/slices"
2424 "k8s.io/kops/pkg/apis/kops"
25+ "k8s.io/kops/pkg/apis/kops/model"
2526 "k8s.io/kops/pkg/wellknownports"
2627 "k8s.io/kops/pkg/wellknownservices"
2728 "k8s.io/kops/upup/pkg/fi"
@@ -127,6 +128,16 @@ func (b *APILoadBalancerBuilder) addFirewallRules(c *fi.CloudupModelBuilderConte
127128 Allowed : []string {"tcp:" + strconv .Itoa (wellknownports .KopsControllerPort )},
128129 })
129130 }
131+
132+ if model .UseCiliumEtcd (b .Cluster ) {
133+ b .AddFirewallRulesTasks (c , "cilium-etcd" , & gcetasks.FirewallRule {
134+ Lifecycle : b .Lifecycle ,
135+ Network : network ,
136+ SourceRanges : b .Cluster .Spec .API .Access ,
137+ TargetTags : []string {b .GCETagForRole (kops .InstanceGroupRoleControlPlane )},
138+ Allowed : []string {"tcp:" + strconv .Itoa (wellknownports .EtcdCiliumClientPort )},
139+ })
140+ }
130141 }
131142 return nil
132143
@@ -234,6 +245,24 @@ func (b *APILoadBalancerBuilder) createInternalLB(c *fi.CloudupModelBuilderConte
234245
235246 c .AddTask (fr )
236247 }
248+
249+ if model .UseCiliumEtcd (b .Cluster ) {
250+ c .AddTask (& gcetasks.ForwardingRule {
251+ Name : s (b .NameForForwardingRule ("cilium-etcd-" + sn .Name )),
252+ Lifecycle : b .Lifecycle ,
253+ BackendService : bs ,
254+ Ports : []string {strconv .Itoa (wellknownports .EtcdCiliumClientPort )},
255+ IPAddress : ipAddress ,
256+ IPProtocol : "TCP" ,
257+ LoadBalancingScheme : s ("INTERNAL" ),
258+ Network : network ,
259+ Subnetwork : subnet ,
260+ Labels : map [string ]string {
261+ clusterLabel .Key : clusterLabel .Value ,
262+ "name" : "cilium-etcd-" + sn .Name ,
263+ },
264+ })
265+ }
237266 }
238267 return nil
239268}
0 commit comments