Change Ingress version from v1beta1 to v1 for K8s 1.22+ compatibility (#2124)
* Change Ingress version from v1beta1 to v1 for K8s 1.22+ compatibility Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> * Minor fix Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -43,7 +43,7 @@ func createIngress(logger *zap.Logger, trigger *fv1.HTTPTrigger, kubeClient *kub
|
|||||||
if !trigger.Spec.CreateIngress {
|
if !trigger.Spec.CreateIngress {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_, err := kubeClient.ExtensionsV1beta1().Ingresses(podNamespace).Create(context.TODO(), util.GetIngressSpec(podNamespace, trigger), v1.CreateOptions{})
|
_, err := kubeClient.NetworkingV1().Ingresses(podNamespace).Create(context.TODO(), util.GetIngressSpec(podNamespace, trigger), v1.CreateOptions{})
|
||||||
if err != nil && !k8serrors.IsAlreadyExists(err) {
|
if err != nil && !k8serrors.IsAlreadyExists(err) {
|
||||||
logger.Error("failed to create ingress", zap.Error(err))
|
logger.Error("failed to create ingress", zap.Error(err))
|
||||||
return
|
return
|
||||||
@@ -56,13 +56,13 @@ func deleteIngress(logger *zap.Logger, trigger *fv1.HTTPTrigger, kubeClient *kub
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ingress, err := kubeClient.ExtensionsV1beta1().Ingresses(podNamespace).Get(context.TODO(), trigger.ObjectMeta.Name, v1.GetOptions{})
|
ingress, err := kubeClient.NetworkingV1().Ingresses(podNamespace).Get(context.TODO(), trigger.ObjectMeta.Name, v1.GetOptions{})
|
||||||
if err != nil && !k8serrors.IsNotFound(err) {
|
if err != nil && !k8serrors.IsNotFound(err) {
|
||||||
logger.Error("failed to get ingress when deleting trigger", zap.Error(err), zap.String("trigger", trigger.ObjectMeta.Name))
|
logger.Error("failed to get ingress when deleting trigger", zap.Error(err), zap.String("trigger", trigger.ObjectMeta.Name))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = kubeClient.ExtensionsV1beta1().Ingresses(podNamespace).Delete(context.TODO(), ingress.Name, v1.DeleteOptions{})
|
err = kubeClient.NetworkingV1().Ingresses(podNamespace).Delete(context.TODO(), ingress.Name, v1.DeleteOptions{})
|
||||||
if err != nil && !k8serrors.IsNotFound(err) {
|
if err != nil && !k8serrors.IsNotFound(err) {
|
||||||
logger.Error("failed to delete ingress for trigger",
|
logger.Error("failed to delete ingress for trigger",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
@@ -86,7 +86,7 @@ func updateIngress(logger *zap.Logger, oldT *fv1.HTTPTrigger, newT *fv1.HTTPTrig
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
oldIngress, err := kubeClient.ExtensionsV1beta1().Ingresses(podNamespace).Get(context.TODO(), oldT.ObjectMeta.Name, v1.GetOptions{})
|
oldIngress, err := kubeClient.NetworkingV1().Ingresses(podNamespace).Get(context.TODO(), oldT.ObjectMeta.Name, v1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if k8serrors.IsNotFound(err) {
|
if k8serrors.IsNotFound(err) {
|
||||||
createIngress(logger, newT, kubeClient)
|
createIngress(logger, newT, kubeClient)
|
||||||
@@ -123,7 +123,7 @@ func updateIngress(logger *zap.Logger, oldT *fv1.HTTPTrigger, newT *fv1.HTTPTrig
|
|||||||
}
|
}
|
||||||
|
|
||||||
if changes {
|
if changes {
|
||||||
_, err = kubeClient.ExtensionsV1beta1().Ingresses(podNamespace).Update(context.TODO(), oldIngress, v1.UpdateOptions{})
|
_, err = kubeClient.NetworkingV1().Ingresses(podNamespace).Update(context.TODO(), oldIngress, v1.UpdateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("failed to update ingress for trigger", zap.Error(err), zap.String("trigger", oldT.ObjectMeta.Name))
|
logger.Error("failed to update ingress for trigger", zap.Error(err), zap.String("trigger", oldT.ObjectMeta.Name))
|
||||||
return
|
return
|
||||||
|
|||||||
+17
-16
@@ -17,14 +17,14 @@ limitations under the License.
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/api/extensions/v1beta1"
|
v1 "k8s.io/api/networking/v1"
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1beta1.Ingress {
|
func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1.Ingress {
|
||||||
// TODO: remove backward compatibility
|
// TODO: remove backward compatibility
|
||||||
host, path := trigger.Spec.Host, trigger.Spec.RelativeURL
|
host, path := trigger.Spec.Host, trigger.Spec.RelativeURL
|
||||||
if trigger.Spec.Prefix != nil && *trigger.Spec.Prefix != "" {
|
if trigger.Spec.Prefix != nil && *trigger.Spec.Prefix != "" {
|
||||||
@@ -41,9 +41,9 @@ func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1beta1.Ingress
|
|||||||
host = "" // wildcard Ingress host
|
host = "" // wildcard Ingress host
|
||||||
}
|
}
|
||||||
|
|
||||||
var ingTLS []v1beta1.IngressTLS
|
var ingTLS []v1.IngressTLS
|
||||||
if len(trigger.Spec.IngressConfig.TLS) > 0 {
|
if len(trigger.Spec.IngressConfig.TLS) > 0 {
|
||||||
ingTLS = []v1beta1.IngressTLS{
|
ingTLS = []v1.IngressTLS{
|
||||||
{
|
{
|
||||||
Hosts: []string{
|
Hosts: []string{
|
||||||
trigger.Spec.IngressConfig.Host,
|
trigger.Spec.IngressConfig.Host,
|
||||||
@@ -53,7 +53,7 @@ func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1beta1.Ingress
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := &v1beta1.Ingress{
|
ing := &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: GetDeployLabels(trigger),
|
Labels: GetDeployLabels(trigger),
|
||||||
Name: trigger.ObjectMeta.Name,
|
Name: trigger.ObjectMeta.Name,
|
||||||
@@ -63,20 +63,21 @@ func GetIngressSpec(namespace string, trigger *fv1.HTTPTrigger) *v1beta1.Ingress
|
|||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Annotations: trigger.Spec.IngressConfig.Annotations,
|
Annotations: trigger.Spec.IngressConfig.Annotations,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
TLS: ingTLS,
|
TLS: ingTLS,
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: host,
|
Host: host,
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: path,
|
Path: path,
|
||||||
|
|||||||
@@ -20,9 +20,8 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/api/extensions/v1beta1"
|
v1 "k8s.io/api/networking/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
|
||||||
|
|
||||||
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
fv1 "github.com/fission/fission/pkg/apis/core/v1"
|
||||||
)
|
)
|
||||||
@@ -35,7 +34,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args args
|
args args
|
||||||
want *v1beta1.Ingress
|
want *v1.Ingress
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "host-backward-compatibility",
|
name: "host-backward-compatibility",
|
||||||
@@ -58,7 +57,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -69,19 +68,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
Namespace: "foobarNS",
|
Namespace: "foobarNS",
|
||||||
Annotations: nil,
|
Annotations: nil,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "test.com",
|
Host: "test.com",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/bar",
|
Path: "/foo/bar",
|
||||||
@@ -116,7 +116,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -129,19 +129,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
"key": "value",
|
"key": "value",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "",
|
Host: "",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/bar",
|
Path: "/foo/bar",
|
||||||
@@ -176,7 +177,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -187,19 +188,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
Namespace: "foobarNS",
|
Namespace: "foobarNS",
|
||||||
Annotations: nil,
|
Annotations: nil,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "test.com",
|
Host: "test.com",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/bar",
|
Path: "/foo/bar",
|
||||||
@@ -234,7 +236,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -245,19 +247,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
Namespace: "foobarNS",
|
Namespace: "foobarNS",
|
||||||
Annotations: nil,
|
Annotations: nil,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "",
|
Host: "",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/{bar}",
|
Path: "/foo/{bar}",
|
||||||
@@ -292,7 +295,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -303,19 +306,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
Namespace: "foobarNS",
|
Namespace: "foobarNS",
|
||||||
Annotations: nil,
|
Annotations: nil,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "",
|
Host: "",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/{bar}",
|
Path: "/foo/{bar}",
|
||||||
@@ -351,7 +355,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -362,19 +366,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
Namespace: "foobarNS",
|
Namespace: "foobarNS",
|
||||||
Annotations: nil,
|
Annotations: nil,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "test.com",
|
Host: "test.com",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/bar",
|
Path: "/foo/bar",
|
||||||
@@ -409,7 +414,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -420,19 +425,20 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
Namespace: "foobarNS",
|
Namespace: "foobarNS",
|
||||||
Annotations: nil,
|
Annotations: nil,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "",
|
Host: "",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/bar",
|
Path: "/foo/bar",
|
||||||
@@ -469,7 +475,7 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: &v1beta1.Ingress{
|
want: &v1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
"triggerName": "foo",
|
"triggerName": "foo",
|
||||||
@@ -482,8 +488,8 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
"key": "value",
|
"key": "value",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1.IngressSpec{
|
||||||
TLS: []v1beta1.IngressTLS{
|
TLS: []v1.IngressTLS{
|
||||||
{
|
{
|
||||||
Hosts: []string{
|
Hosts: []string{
|
||||||
"test.com",
|
"test.com",
|
||||||
@@ -491,18 +497,19 @@ func TestGetIngressSpec(t *testing.T) {
|
|||||||
SecretName: "foobar",
|
SecretName: "foobar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Rules: []v1beta1.IngressRule{
|
Rules: []v1.IngressRule{
|
||||||
{
|
{
|
||||||
Host: "",
|
Host: "",
|
||||||
IngressRuleValue: v1beta1.IngressRuleValue{
|
IngressRuleValue: v1.IngressRuleValue{
|
||||||
HTTP: &v1beta1.HTTPIngressRuleValue{
|
HTTP: &v1.HTTPIngressRuleValue{
|
||||||
Paths: []v1beta1.HTTPIngressPath{
|
Paths: []v1.HTTPIngressPath{
|
||||||
{
|
{
|
||||||
Backend: v1beta1.IngressBackend{
|
Backend: v1.IngressBackend{
|
||||||
ServiceName: "router",
|
Service: &v1.IngressServiceBackend{
|
||||||
ServicePort: intstr.IntOrString{
|
Name: "router",
|
||||||
Type: intstr.Int,
|
Port: v1.ServiceBackendPort{
|
||||||
IntVal: 80,
|
Number: 80,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Path: "/foo/bar",
|
Path: "/foo/bar",
|
||||||
|
|||||||
Reference in New Issue
Block a user