Skip to content

Commit

Permalink
Migrate to networking.k8s.io v1
Browse files Browse the repository at this point in the history
  • Loading branch information
anandswaminathan committed Nov 15, 2022
1 parent 4356402 commit 5e80499
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions pkg/controller/flink/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/lyft/flinkk8soperator/pkg/controller/common"
"github.com/lyft/flinkk8soperator/pkg/controller/config"
"github.com/lyft/flinkk8soperator/pkg/controller/k8"
"k8s.io/api/networking/v1beta1"
v1network "k8s.io/api/networking/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
Expand All @@ -25,7 +25,7 @@ func GetFlinkUIIngressURL(jobName string) string {
return ReplaceJobURL(config.GetConfig().FlinkIngressURLFormat, jobName)
}

func FetchJobManagerIngressCreateObj(app *flinkapp.FlinkApplication) *v1beta1.Ingress {
func FetchJobManagerIngressCreateObj(app *flinkapp.FlinkApplication) *v1network.Ingress {
podLabels := common.DuplicateMap(app.Labels)
podLabels = common.CopyMap(podLabels, k8.GetAppLabel(app.Name))

Expand All @@ -38,30 +38,30 @@ func FetchJobManagerIngressCreateObj(app *flinkapp.FlinkApplication) *v1beta1.In
},
}

backend := v1beta1.IngressBackend{
backend := v1network.IngressBackend{
ServiceName: getJobManagerServiceName(app),
ServicePort: intstr.IntOrString{
Type: intstr.Int,
IntVal: getUIPort(app),
},
}

ingressSpec := v1beta1.IngressSpec{
Rules: []v1beta1.IngressRule{{
ingressSpec := v1network.IngressSpec{
Rules: []v1network.IngressRule{{
Host: GetFlinkUIIngressURL(getIngressName(app)),
IngressRuleValue: v1beta1.IngressRuleValue{
HTTP: &v1beta1.HTTPIngressRuleValue{
Paths: []v1beta1.HTTPIngressPath{{
IngressRuleValue: v1network.IngressRuleValue{
HTTP: &v1network.HTTPIngressRuleValue{
Paths: []v1network.HTTPIngressPath{{
Backend: backend,
}},
},
},
}},
}
return &v1beta1.Ingress{
return &v1network.Ingress{
ObjectMeta: ingressMeta,
TypeMeta: v1.TypeMeta{
APIVersion: v1beta1.SchemeGroupVersion.String(),
APIVersion: v1network.SchemeGroupVersion.String(),
Kind: k8.Ingress,
},
Spec: ingressSpec,
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/flink/job_manager_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/apps/v1"
coreV1 "k8s.io/api/core/v1"
"k8s.io/api/networking/v1beta1"
v1network "k8s.io/api/networking/v1"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestJobManagerCreateSuccess(t *testing.T) {
labels := map[string]string{
"flink-app": "app-name",
}
ingress := object.(*v1beta1.Ingress)
ingress := object.(*v1network.Ingress)
assert.Equal(t, app.Name, ingress.Name)
assert.Equal(t, app.Namespace, ingress.Namespace)
assert.Equal(t, labels, ingress.Labels)
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestJobManagerHACreateSuccess(t *testing.T) {
labels := map[string]string{
"flink-app": "app-name",
}
ingress := object.(*v1beta1.Ingress)
ingress := object.(*v1network.Ingress)
assert.Equal(t, app.Name, ingress.Name)
assert.Equal(t, app.Namespace, ingress.Namespace)
assert.Equal(t, labels, ingress.Labels)
Expand Down Expand Up @@ -430,7 +430,7 @@ func TestJobManagerCreateSuccessWithVersion(t *testing.T) {
labels := map[string]string{
"flink-app": "app-name",
}
ingress := object.(*v1beta1.Ingress)
ingress := object.(*v1network.Ingress)
assert.Equal(t, app.Name+"-"+testVersion, ingress.Name)
assert.Equal(t, app.Namespace, ingress.Namespace)
assert.Equal(t, labels, ingress.Labels)
Expand Down

0 comments on commit 5e80499

Please sign in to comment.