Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dual-Stack Capabilities to NSC #1544

Merged
merged 15 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ DOCKER_LINT_IMAGE?=golangci/golangci-lint:v1.50.1
GOBGP_VERSION=v3.17.0
QEMU_IMAGE?=multiarch/qemu-user-static
GORELEASER_VERSION=v1.14.1
MOQ_VERSION=v0.2.1
MOQ_VERSION=v0.3.2
UID?=$(shell id -u)
ifeq ($(GOARCH), arm)
ARCH_TAG_PREFIX=$(GOARCH)
Expand Down Expand Up @@ -186,7 +186,7 @@ gofmt-fix: ## Fixes files that need to be gofmt'd.

# List of all file_moq.go files which would need to be regenerated
# from file.go if changed
gomoqs: ./pkg/controllers/proxy/network_services_controller_moq.go
gomoqs: ./pkg/controllers/proxy/linux_networking_moq.go

# file_moq.go file is generated from file.go "//go:generate moq ..." in-file
# annotation, as it needs to know which interfaces to create mock stubs for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ rules:
- services/status
verbs:
- update
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
Expand Down
8 changes: 8 additions & 0 deletions daemonset/generic-kuberouter-all-features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ rules:
- services/status
verbs:
- update
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
10 changes: 9 additions & 1 deletion daemonset/generic-kuberouter-only-advertise-routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ rules:
- services/status
verbs:
- update

- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
10 changes: 9 additions & 1 deletion daemonset/generic-kuberouter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,15 @@ rules:
- services/status
verbs:
- update

- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
9 changes: 9 additions & 0 deletions daemonset/kubeadm-kuberouter-all-features-dsr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ rules:
- services/status
verbs:
- update
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
9 changes: 9 additions & 0 deletions daemonset/kubeadm-kuberouter-all-features-hostport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ rules:
- services/status
verbs:
- update
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
9 changes: 9 additions & 0 deletions daemonset/kubeadm-kuberouter-all-features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ rules:
- services/status
verbs:
- update
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
9 changes: 9 additions & 0 deletions daemonset/kubeadm-kuberouter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ rules:
- services/status
verbs:
- update
- apiGroups:
- "discovery.k8s.io"
resources:
- endpointslices
verbs:
- get
- list
- watch

---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/kube-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (kr *KubeRouter) Run() error {
informerFactory := informers.NewSharedInformerFactory(kr.Client, 0)
svcInformer := informerFactory.Core().V1().Services().Informer()
epInformer := informerFactory.Core().V1().Endpoints().Informer()
epSliceInformer := informerFactory.Discovery().V1().EndpointSlices().Informer()
podInformer := informerFactory.Core().V1().Pods().Informer()
nodeInformer := informerFactory.Core().V1().Nodes().Informer()
nsInformer := informerFactory.Core().V1().Namespaces().Informer()
Expand Down Expand Up @@ -177,7 +178,7 @@ func (kr *KubeRouter) Run() error {

if kr.Config.RunServiceProxy {
nsc, err := proxy.NewNetworkServicesController(kr.Client, kr.Config,
svcInformer, epInformer, podInformer, &ipsetMutex)
svcInformer, epSliceInformer, podInformer, &ipsetMutex)
if err != nil {
return fmt.Errorf("failed to create network services controller: %v", err)
}
Expand All @@ -186,7 +187,7 @@ func (kr *KubeRouter) Run() error {
if err != nil {
return fmt.Errorf("failed to add ServiceEventHandler: %v", err)
}
_, err = epInformer.AddEventHandler(nsc.EndpointsEventHandler)
_, err = epSliceInformer.AddEventHandler(nsc.EndpointSliceEventHandler)
if err != nil {
return fmt.Errorf("failed to add EndpointsEventHandler: %v", err)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/controllers/netpol/network_policy_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ func (ips *fakeIPSet) Sets() map[string]*utils.Set {
return nil
}

func (ips *fakeIPSet) Name(name string) string {
return name
}

func TestNetworkPolicyController(t *testing.T) {
testCases := []tNetPolConfigTestCase{
{
Expand Down
Loading