Skip to content

Commit

Permalink
pkg/k8s: wait for EndpointSlice to be ready before initializing Cilium
Browse files Browse the repository at this point in the history
Similar to the v1.Endpoints, in case Cilium is running with
EndpointSlice enabled, it should wait for the k8s watchers watching
those resources before it starts.

Fixes: c3b5ca6 ("add support for k8s endpoint slice")
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Jun 9, 2020
1 parent 009fb34 commit b4627b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion daemon/cmd/daemon_main.go
Expand Up @@ -1223,7 +1223,11 @@ func (d *Daemon) initKVStore() {
// up etcd so we can perform the name resolution for etcd-operator
// to the service IP as well perform the service -> backend IPs for
// that service IP.
d.k8sWatcher.WaitForCacheSync(watchers.K8sAPIGroupServiceV1Core, watchers.K8sAPIGroupEndpointV1Core)
d.k8sWatcher.WaitForCacheSync(
watchers.K8sAPIGroupServiceV1Core,
watchers.K8sAPIGroupEndpointV1Core,
watchers.K8sAPIGroupEndpointSliceV1Beta1Discovery,
)
log := log.WithField(logfields.LogSubsys, "etcd")
goopts.DialOption = []grpc.DialOption{
grpc.WithDialer(k8s.CreateCustomDialer(&d.k8sWatcher.K8sSvcCache, log)),
Expand Down
1 change: 1 addition & 0 deletions pkg/k8s/watchers/watcher.go
Expand Up @@ -370,6 +370,7 @@ func (k *K8sWatcher) InitK8sSubsystem() <-chan struct{} {
// To perform the service translation and have the BPF LB datapath
// with the right service -> backend (k8s endpoints) translation.
K8sAPIGroupEndpointV1Core,
K8sAPIGroupEndpointSliceV1Beta1Discovery,
// We need all network policies in place before restoring to make sure
// we are enforcing the correct policies for each endpoint before
// restarting.
Expand Down

0 comments on commit b4627b7

Please sign in to comment.