Skip to content

Commit 9ff57d4

Browse files
committed
Fix cilium-etcd on GCE
This adds the firewall rule and forwarding rule allowing access from nodes to the control plane's cilium etcd port 4003
1 parent 3f293c5 commit 9ff57d4

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

pkg/model/gcemodel/api_loadbalancer.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)