Skip to content

Commit

Permalink
chore(K8s): migrate from CoreV1 Endpoints to DiscoveryV1 EndpointSlice (
Browse files Browse the repository at this point in the history
  • Loading branch information
programmer04 committed May 16, 2023
1 parent 4fa7cf0 commit 11ff796
Show file tree
Hide file tree
Showing 18 changed files with 329 additions and 385 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ Adding a new version? You'll need three changes:
once their installation is detected, making restarting the process unnecessary.
[#3996](https://github.com/Kong/kubernetes-ingress-controller/pull/3996)

### Changed

- Kong Ingress Controller no longer relies on `k8s.io.api.core.v1` `Endpoints`,
and instead uses `discovery.k8s.io/v1` `EndpointSlice` to discover endpoints
for Kubernetes Services.
[#3997](https://github.com/Kong/kubernetes-ingress-controller/pull/3997)
[#3998](https://github.com/Kong/kubernetes-ingress-controller/pull/3998)
[#3980](https://github.com/Kong/kubernetes-ingress-controller/pull/3980)
[#3977](https://github.com/Kong/kubernetes-ingress-controller/pull/3977)

### Fixed

- Fix paging in `GetAdminAPIsForService` which might have caused the controller
Expand Down
15 changes: 0 additions & 15 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-dbless-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-dbless-k4k8s-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-dbless-konnect-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-dbless-konnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-dbless-legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-dbless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-postgres-enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
15 changes: 0 additions & 15 deletions deploy/single/all-in-one-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1167,21 +1167,6 @@ kind: ClusterRole
metadata:
name: kong-ingress
rules:
- apiGroups:
- ""
resources:
- endpoints
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- endpoints/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand Down
24 changes: 13 additions & 11 deletions hack/generators/controllers/networking/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import (
const (
outputFile = "../../internal/controllers/configuration/zz_generated_controllers.go"

corev1 = "k8s.io/api/core/v1"
netv1 = "k8s.io/api/networking/v1"
corev1 = "k8s.io/api/core/v1"
discoveryv1 = "k8s.io/api/discovery/v1"
netv1 = "k8s.io/api/networking/v1"

kongv1 = "github.com/kong/kubernetes-ingress-controller/v2/pkg/apis/configuration/v1"
kongv1beta1 = "github.com/kong/kubernetes-ingress-controller/v2/api/configuration/v1beta1"
Expand Down Expand Up @@ -45,15 +46,15 @@ var inputControllersNeeded = &typesNeeded{
RBACVerbs: []string{"get", "list", "watch"},
},
typeNeeded{
Group: "\"\"",
Group: "discovery.k8s.io",
Version: "v1",
Kind: "Endpoints",
PackageImportAlias: "corev1",
PackageAlias: "CoreV1",
Package: corev1,
Plural: "endpoints",
CacheType: "Endpoint",
NeedsStatusPermissions: true,
Kind: "EndpointSlice",
PackageImportAlias: "discoveryv1",
PackageAlias: "DiscoveryV1",
Package: discoveryv1,
Plural: "endpointslices",
CacheType: "EndpointSlice",
NeedsStatusPermissions: false,
AcceptsIngressClassNameAnnotation: false,
AcceptsIngressClassNameSpec: false,
RBACVerbs: []string{"list", "watch"},
Expand Down Expand Up @@ -360,6 +361,7 @@ import (
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
discoveryv1 "k8s.io/api/discovery/v1"
netv1 "k8s.io/api/networking/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -584,7 +586,7 @@ func (r *{{.PackageAlias}}{{.Kind}}Reconciler) Reconcile(ctx context.Context, re
// if status updates are enabled report the status for the object
if r.DataplaneClient.AreKubernetesObjectReportsEnabled() {
log.V(util.DebugLevel).Info("determining whether data-plane configuration has succeeded", "namespace", req.Namespace, "name", req.Name)
if !r.DataplaneClient.KubernetesObjectIsConfigured(obj) {
log.V(util.DebugLevel).Info("resource not yet configured in the data-plane", "namespace", req.Namespace, "name", req.Name)
return ctrl.Result{Requeue: true}, nil // requeue until the object has been properly configured
Expand Down
24 changes: 12 additions & 12 deletions internal/controllers/configuration/zz_generated_controllers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 11ff796

Please sign in to comment.