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 API groups in K8s 1.16 #192

Merged
merged 1 commit into from
Oct 10, 2019
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 deploy-all-in-one-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ data:
ca-certificates.crt: ENCODED_CERTIFICATE
---
# deployment
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: botkube
Expand Down
2 changes: 1 addition & 1 deletion deploy-all-in-one.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ subjects:
namespace: botkube
---
# deployment
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: botkube
Expand Down
2 changes: 1 addition & 1 deletion helm/botkube/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "botkube.fullname" . }}
Expand Down
4 changes: 2 additions & 2 deletions pkg/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
appsV1 "k8s.io/api/apps/v1"
batchV1 "k8s.io/api/batch/v1"
apiV1 "k8s.io/api/core/v1"
extV1beta1 "k8s.io/api/extensions/v1beta1"
networkV1beta1 "k8s.io/api/networking/v1beta1"
rbacV1 "k8s.io/api/rbac/v1"
)

Expand Down Expand Up @@ -134,7 +134,7 @@ func New(object interface{}, eventType config.EventType, kind string) Event {
case *apiV1.ConfigMap:
event.Kind = "ConfigMap"

case *extV1beta1.Ingress:
case *networkV1beta1.Ingress:
event.Kind = "Ingress"

case *appsV1.DaemonSet:
Expand Down
4 changes: 2 additions & 2 deletions pkg/filterengine/filters/ingress_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/infracloudio/botkube/pkg/events"
"github.com/infracloudio/botkube/pkg/filterengine"
log "github.com/infracloudio/botkube/pkg/logging"
extV1beta1 "k8s.io/api/extensions/v1beta1"
networkV1beta1 "k8s.io/api/networking/v1beta1"
)

// IngressValidator checks if service and tls secret used in ingress specs is already present
Expand All @@ -28,7 +28,7 @@ func (iv IngressValidator) Run(object interface{}, event *events.Event) {
if event.Kind != "Ingress" || event.Type != config.CreateEvent {
return
}
ingressObj, ok := object.(*extV1beta1.Ingress)
ingressObj, ok := object.(*networkV1beta1.Ingress)
if !ok {
return
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
appsV1 "k8s.io/api/apps/v1"
batchV1 "k8s.io/api/batch/v1"
apiV1 "k8s.io/api/core/v1"
extV1beta1 "k8s.io/api/extensions/v1beta1"
networkV1beta1 "k8s.io/api/networking/v1beta1"
rbacV1 "k8s.io/api/rbac/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers"
Expand Down Expand Up @@ -103,7 +103,7 @@ func InitInformerMap() {
ResourceInformerMap["replicaset"] = KubeInformerFactory.Apps().V1().ReplicaSets().Informer()
ResourceInformerMap["statefulset"] = KubeInformerFactory.Apps().V1().StatefulSets().Informer()

ResourceInformerMap["ingress"] = KubeInformerFactory.Extensions().V1beta1().Ingresses().Informer()
ResourceInformerMap["ingress"] = KubeInformerFactory.Networking().V1beta1().Ingresses().Informer()

ResourceInformerMap["job"] = KubeInformerFactory.Batch().V1().Jobs().Informer()

Expand Down Expand Up @@ -186,7 +186,7 @@ func GetObjectMetaData(obj interface{}) metaV1.ObjectMeta {
case *appsV1.StatefulSet:
objectMeta = object.ObjectMeta

case *extV1beta1.Ingress:
case *networkV1beta1.Ingress:
objectMeta = object.ObjectMeta

case *batchV1.Job:
Expand Down Expand Up @@ -240,7 +240,7 @@ func GetObjectTypeMetaData(obj interface{}) metaV1.TypeMeta {
case *appsV1.StatefulSet:
typeMeta = object.TypeMeta

case *extV1beta1.Ingress:
case *networkV1beta1.Ingress:
typeMeta = object.TypeMeta

case *batchV1.Job:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/nlopes/slack"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
extV1beta1 "k8s.io/api/extensions/v1beta1"
networkV1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
Expand Down Expand Up @@ -54,7 +54,7 @@ func (c *context) testFilters(t *testing.T) {
"test IngressValidator filter": {
Kind: "ingress",
Namespace: "test",
Specs: &extV1beta1.Ingress{ObjectMeta: metav1.ObjectMeta{Name: "ingress-with-service"}, Spec: extV1beta1.IngressSpec{Rules: []extV1beta1.IngressRule{{IngressRuleValue: extV1beta1.IngressRuleValue{HTTP: &extV1beta1.HTTPIngressRuleValue{Paths: []extV1beta1.HTTPIngressPath{{Path: "testpath", Backend: extV1beta1.IngressBackend{ServiceName: "test-service", ServicePort: intstr.FromInt(80)}}}}}}}}},
Specs: &networkV1beta1.Ingress{ObjectMeta: metav1.ObjectMeta{Name: "ingress-with-service"}, Spec: networkV1beta1.IngressSpec{Rules: []networkV1beta1.IngressRule{{IngressRuleValue: networkV1beta1.IngressRuleValue{HTTP: &networkV1beta1.HTTPIngressRuleValue{Paths: []networkV1beta1.HTTPIngressPath{{Path: "testpath", Backend: networkV1beta1.IngressBackend{ServiceName: "test-service", ServicePort: intstr.FromInt(80)}}}}}}}}},
ExpectedSlackMessage: utils.SlackMessage{
Attachments: []slack.Attachment{{Color: "good", Fields: []slack.AttachmentField{{Title: "Ingress create", Value: "Ingress *test/ingress-with-service* has been created in *test-cluster-1* cluster\n```Warnings:\n- Service 'test-service' used in ingress 'ingress-with-service' config does not exist or port '80' not exposed\n```", Short: false}}, Footer: "BotKube"}},
},
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/infracloudio/botkube/pkg/utils"
"github.com/nlopes/slack"
v1 "k8s.io/api/core/v1"
extV1beta1 "k8s.io/api/extensions/v1beta1"
networkV1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
)

Expand Down Expand Up @@ -51,8 +51,8 @@ func CreateResource(t *testing.T, obj CreateObjects) {
t.Fatalf("Failed to create service: %v", err)
}
case "ingress":
s := obj.Specs.(*extV1beta1.Ingress)
_, err := utils.KubeClient.ExtensionsV1beta1().Ingresses(obj.Namespace).Create(s)
s := obj.Specs.(*networkV1beta1.Ingress)
_, err := utils.KubeClient.NetworkingV1beta1().Ingresses(obj.Namespace).Create(s)
if err != nil {
t.Fatalf("Failed to create service: %v", err)
}
Expand Down