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

Update deprecated APIs in Docs #613

Merged
merged 3 commits into from
Jul 20, 2020
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
2 changes: 1 addition & 1 deletion docs/content/en/docs/configuration/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ remove old configuration files. If `0`, the default value, a single `haproxy.cfg
Some infrastructure tools like `external-DNS` relay in the ingress status to created access routes to the services exposed with ingress object.

```
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
...
status:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/examples/blue-green.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Configure the ingress resource. No need to change the host below, `bluegreen.exa

```
$ kubectl create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/examples/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Create the ingress which will expose Grafana. Change `HOST` below to a domain of
```
HOST=grafana.192.168.1.1.nip.io
kubectl create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: grafana
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/examples/metrics/whoami-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/examples/modsecurity.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ No need to use a valid domain, `echo.domain` below is fine:

```console
$ kubectl create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/docs/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Obs.: `nip.io` is a convenient service which converts a valid domain name to any
```shell
$ HOST=nginx.192.168.1.1.nip.io
$ kubectl create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: nginx
Expand Down
10 changes: 6 additions & 4 deletions docs/haproxy-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
name: ingress-controller
namespace: ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ingress-controller
Expand Down Expand Up @@ -42,6 +42,7 @@ rules:
- watch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses
verbs:
Expand All @@ -57,12 +58,13 @@ rules:
- patch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ingress-controller
Expand Down Expand Up @@ -99,7 +101,7 @@ rules:
- create
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ingress-controller
Expand All @@ -115,7 +117,7 @@ subjects:
kind: User
name: ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ingress-controller
Expand Down
10 changes: 6 additions & 4 deletions docs/static/resources/haproxy-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
name: ingress-controller
namespace: ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ingress-controller
Expand Down Expand Up @@ -41,6 +41,7 @@ rules:
- watch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses
verbs:
Expand All @@ -56,12 +57,13 @@ rules:
- patch
- apiGroups:
- "extensions"
- "networking.k8s.io"
resources:
- ingresses/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ingress-controller
Expand Down Expand Up @@ -98,7 +100,7 @@ rules:
- create
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ingress-controller
Expand All @@ -114,7 +116,7 @@ subjects:
kind: User
name: ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ingress-controller
Expand Down
4 changes: 2 additions & 2 deletions examples/auth/oauth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ After editing, create the oauth2-proxy deployment and service:

```
$ kubectl create -f oauth2-proxy.yaml
deployment.extensions "oauth2-proxy" created
deployment.apps "oauth2-proxy" created
service "oauth2-proxy" exposed
```

Expand Down Expand Up @@ -93,7 +93,7 @@ After editing, create the ingress resource:

```
$ kubectl create -f app.yaml
ingress.extensions "app" created
ingress.networking.k8s.io/app created
```

Fire a request to your domain and an optional `/uri`. Your OAuth2
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/oauth/app.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion examples/blue-green/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Configure the ingress resource. No need to change the host below, `bluegreen.exa

```
$ kubectl create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion examples/deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ From now the optional web app should be deployed. Deploy an ingress resource to

```console
$ kubectl --namespace=ingress-controller create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: app
Expand Down
2 changes: 1 addition & 1 deletion examples/deployment/haproxy-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# see https://kubernetes.io/docs/reference/workloads-18-19
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion examples/modsecurity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ No need to use a valid domain, `echo.domain` below is fine:

```console
$ kubectl create -f - <<EOF
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-tls/ingress-multi-tls.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: app
Expand Down
8 changes: 4 additions & 4 deletions examples/rbac/ingress-controller-rbac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:
name: ingress-controller
namespace: ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ingress-controller
Expand Down Expand Up @@ -62,7 +62,7 @@ rules:
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ingress-controller
Expand Down Expand Up @@ -99,7 +99,7 @@ rules:
- create
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ingress-controller
Expand All @@ -115,7 +115,7 @@ subjects:
kind: User
name: ingress-controller
---
apiVersion: rbac.authorization.k8s.io/v1beta1
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ingress-controller
Expand Down
2 changes: 1 addition & 1 deletion examples/tls-termination/ingress-tls-default.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: app
Expand Down
2 changes: 1 addition & 1 deletion examples/tls-termination/ingress-tls-foobar.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: app
Expand Down
6 changes: 3 additions & 3 deletions pkg/common/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/golang/glog"

apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
clientset "k8s.io/client-go/kubernetes"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/record"
Expand All @@ -38,7 +38,7 @@ import (
// NewCtrlIntf is a temporary interface used by this generic and now
// deprecated controller to call functionality moved to the new controller.
type NewCtrlIntf interface {
GetIngressList() ([]*extensions.Ingress, error)
GetIngressList() ([]*networking.Ingress, error)
GetSecret(name string) (*apiv1.Secret, error)
Notify()
}
Expand Down Expand Up @@ -128,7 +128,7 @@ func newIngressController(config *Configuration) *GenericController {
const IngressClassKey = "kubernetes.io/ingress.class"

// IsValidClass ...
func (ic *GenericController) IsValidClass(ing *extensions.Ingress) bool {
func (ic *GenericController) IsValidClass(ing *networking.Ingress) bool {
ann, found := ing.Annotations[IngressClassKey]

if ic.cfg.IgnoreIngressWithoutClass {
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/ingress/controller/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func NewIngressController(backend ingress.Controller) *GenericController {
}

if *watchNamespace != "" {
_, err = kubeClient.ExtensionsV1beta1().Ingresses(*watchNamespace).List(metav1.ListOptions{Limit: 1})
_, err = kubeClient.NetworkingV1beta1().Ingresses(*watchNamespace).List(metav1.ListOptions{Limit: 1})
if err != nil {
glog.Fatalf("no watchNamespace with name %v found: %v", *watchNamespace, err)
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/common/ingress/controller/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

pool "gopkg.in/go-playground/pool.v3"
apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -310,11 +310,11 @@ func (s *statusSync) updateStatus(newIngressPoint []apiv1.LoadBalancerIngress) e
continue
}

var callback func(*extensions.Ingress) []apiv1.LoadBalancerIngress
var callback func(*networking.Ingress) []apiv1.LoadBalancerIngress
if s.ic.cfg.Backend != nil {
callback = s.ic.cfg.Backend.UpdateIngressStatus
} else {
callback = func(*extensions.Ingress) []apiv1.LoadBalancerIngress { return nil }
callback = func(*networking.Ingress) []apiv1.LoadBalancerIngress { return nil }
}
batch.Queue(runUpdate(ing, newIngressPoint, s.ic.cfg.Client, callback))
}
Expand All @@ -325,9 +325,9 @@ func (s *statusSync) updateStatus(newIngressPoint []apiv1.LoadBalancerIngress) e
return nil
}

func runUpdate(ing *extensions.Ingress, status []apiv1.LoadBalancerIngress,
func runUpdate(ing *networking.Ingress, status []apiv1.LoadBalancerIngress,
client clientset.Interface,
statusFunc func(*extensions.Ingress) []apiv1.LoadBalancerIngress) pool.WorkFunc {
statusFunc func(*networking.Ingress) []apiv1.LoadBalancerIngress) pool.WorkFunc {
return func(wu pool.WorkUnit) (interface{}, error) {
if wu.IsCancelled() {
return nil, nil
Expand All @@ -348,7 +348,7 @@ func runUpdate(ing *extensions.Ingress, status []apiv1.LoadBalancerIngress,
return true, nil
}

ingClient := client.ExtensionsV1beta1().Ingresses(ing.Namespace)
ingClient := client.NetworkingV1beta1().Ingresses(ing.Namespace)

currIng, err := ingClient.Get(ing.Name, metav1.GetOptions{})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/common/ingress/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/spf13/pflag"
apiv1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
networking "k8s.io/api/networking/v1beta1"
"k8s.io/apiserver/pkg/server/healthz"
)

Expand Down Expand Up @@ -53,7 +53,7 @@ type Controller interface {
// UpdateIngressStatus custom callback used to update the status in an Ingress rule
// This allows custom implementations
// If the function returns nil the standard functions will be executed.
UpdateIngressStatus(*extensions.Ingress) []apiv1.LoadBalancerIngress
UpdateIngressStatus(*networking.Ingress) []apiv1.LoadBalancerIngress
}

// BackendInfo returns information about the backend.
Expand Down
Loading