mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Merge pull request #89778 from cmluciano/cml/ingressv1
ingress: Add Ingress to v1 API and update backend to defaultBackend
This commit is contained in:
commit
53f3699cf9
2315
api/openapi-spec/swagger.json
generated
2315
api/openapi-spec/swagger.json
generated
File diff suppressed because it is too large
Load Diff
@ -37,13 +37,17 @@ go_library(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["defaults_test.go"],
|
||||
srcs = [
|
||||
"conversion_test.go",
|
||||
"defaults_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/install:go_default_library",
|
||||
"//pkg/apis/extensions/install:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
|
||||
@ -51,6 +55,8 @@ go_test(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
||||
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
@ -157,3 +158,57 @@ func Convert_networking_IPBlock_To_v1beta1_IPBlock(in *networking.IPBlock, out *
|
||||
copy(out.Except, in.Except)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_IngressBackend_To_networking_IngressBackend(in *extensionsv1beta1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
if err := autoConvert_v1beta1_IngressBackend_To_networking_IngressBackend(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(in.ServiceName) > 0 || in.ServicePort.IntVal != 0 || in.ServicePort.StrVal != "" || in.ServicePort.Type == intstr.String {
|
||||
out.Service = &networking.IngressServiceBackend{}
|
||||
out.Service.Name = in.ServiceName
|
||||
out.Service.Port.Name = in.ServicePort.StrVal
|
||||
out.Service.Port.Number = in.ServicePort.IntVal
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.IngressBackend, out *extensionsv1beta1.IngressBackend, s conversion.Scope) error {
|
||||
if err := autoConvert_networking_IngressBackend_To_v1beta1_IngressBackend(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Service != nil {
|
||||
out.ServiceName = in.Service.Name
|
||||
if len(in.Service.Port.Name) > 0 {
|
||||
out.ServicePort = intstr.FromString(in.Service.Port.Name)
|
||||
} else {
|
||||
out.ServicePort = intstr.FromInt(int(in.Service.Port.Number))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_IngressSpec_To_networking_IngressSpec(in *extensionsv1beta1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
if err := autoConvert_v1beta1_IngressSpec_To_networking_IngressSpec(in, out, s); err != nil {
|
||||
return nil
|
||||
}
|
||||
if in.Backend != nil {
|
||||
out.DefaultBackend = &networking.IngressBackend{}
|
||||
if err := Convert_v1beta1_IngressBackend_To_networking_IngressBackend(in.Backend, out.DefaultBackend, s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_IngressSpec_To_v1beta1_IngressSpec(in *networking.IngressSpec, out *extensionsv1beta1.IngressSpec, s conversion.Scope) error {
|
||||
if err := autoConvert_networking_IngressSpec_To_v1beta1_IngressSpec(in, out, s); err != nil {
|
||||
return nil
|
||||
}
|
||||
if in.DefaultBackend != nil {
|
||||
out.Backend = &extensionsv1beta1.IngressBackend{}
|
||||
if err := Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in.DefaultBackend, out.Backend, s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
108
pkg/apis/extensions/v1beta1/conversion_test.go
Normal file
108
pkg/apis/extensions/v1beta1/conversion_test.go
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"k8s.io/api/extensions/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
func TestIngressBackendConversion(t *testing.T) {
|
||||
scheme := runtime.NewScheme()
|
||||
assert.NoError(t, RegisterConversions(scheme))
|
||||
|
||||
tests := map[string]struct {
|
||||
external v1beta1.IngressSpec
|
||||
internal networking.IngressSpec
|
||||
}{
|
||||
"service-port-number": {
|
||||
external: v1beta1.IngressSpec{
|
||||
Backend: &v1beta1.IngressBackend{
|
||||
ServiceName: "test-backend",
|
||||
ServicePort: intstr.FromInt(8080),
|
||||
},
|
||||
},
|
||||
internal: networking.IngressSpec{
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "test-backend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "",
|
||||
Number: 8080,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"service-named-port": {
|
||||
external: v1beta1.IngressSpec{
|
||||
Backend: &v1beta1.IngressBackend{
|
||||
ServiceName: "test-backend",
|
||||
ServicePort: intstr.FromString("https"),
|
||||
},
|
||||
},
|
||||
internal: networking.IngressSpec{
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "test-backend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "https",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"empty-service-name": {
|
||||
external: v1beta1.IngressSpec{
|
||||
Backend: &v1beta1.IngressBackend{
|
||||
ServiceName: "",
|
||||
ServicePort: intstr.FromString("https"),
|
||||
},
|
||||
},
|
||||
internal: networking.IngressSpec{
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "https",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, test := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
convertedInternal := networking.IngressSpec{}
|
||||
require.NoError(t,
|
||||
Convert_v1beta1_IngressSpec_To_networking_IngressSpec(&test.external, &convertedInternal, nil))
|
||||
assert.Equal(t, test.internal, convertedInternal, "v1beta1.IngressSpec -> networking.IngressSpec")
|
||||
|
||||
convertedV1beta1 := v1beta1.IngressSpec{}
|
||||
require.NoError(t,
|
||||
Convert_networking_IngressSpec_To_v1beta1_IngressSpec(&test.internal, &convertedV1beta1, nil))
|
||||
assert.Equal(t, test.external, convertedV1beta1, "networking.IngressSpec -> v1beta1.IngressSpec")
|
||||
})
|
||||
}
|
||||
}
|
139
pkg/apis/extensions/v1beta1/zz_generated.conversion.go
generated
139
pkg/apis/extensions/v1beta1/zz_generated.conversion.go
generated
@ -264,16 +264,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressBackend)(nil), (*networking.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressBackend_To_networking_IngressBackend(a.(*v1beta1.IngressBackend), b.(*networking.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressBackend)(nil), (*v1beta1.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressBackend_To_v1beta1_IngressBackend(a.(*networking.IngressBackend), b.(*v1beta1.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressList)(nil), (*networking.IngressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressList_To_networking_IngressList(a.(*v1beta1.IngressList), b.(*networking.IngressList), scope)
|
||||
}); err != nil {
|
||||
@ -304,16 +294,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressSpec)(nil), (*networking.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressSpec_To_networking_IngressSpec(a.(*v1beta1.IngressSpec), b.(*networking.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressSpec)(nil), (*v1beta1.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressSpec_To_v1beta1_IngressSpec(a.(*networking.IngressSpec), b.(*v1beta1.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressStatus)(nil), (*networking.IngressStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressStatus_To_networking_IngressStatus(a.(*v1beta1.IngressStatus), b.(*networking.IngressStatus), scope)
|
||||
}); err != nil {
|
||||
@ -564,6 +544,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*networking.IngressBackend)(nil), (*v1beta1.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressBackend_To_v1beta1_IngressBackend(a.(*networking.IngressBackend), b.(*v1beta1.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*networking.IngressSpec)(nil), (*v1beta1.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressSpec_To_v1beta1_IngressSpec(a.(*networking.IngressSpec), b.(*v1beta1.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*networking.NetworkPolicyEgressRule)(nil), (*v1beta1.NetworkPolicyEgressRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_NetworkPolicyEgressRule_To_v1beta1_NetworkPolicyEgressRule(a.(*networking.NetworkPolicyEgressRule), b.(*v1beta1.NetworkPolicyEgressRule), scope)
|
||||
}); err != nil {
|
||||
@ -584,6 +574,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.IngressBackend)(nil), (*networking.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressBackend_To_networking_IngressBackend(a.(*v1beta1.IngressBackend), b.(*networking.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.IngressSpec)(nil), (*networking.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressSpec_To_networking_IngressSpec(a.(*v1beta1.IngressSpec), b.(*networking.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.NetworkPolicyEgressRule)(nil), (*networking.NetworkPolicyEgressRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_NetworkPolicyEgressRule_To_networking_NetworkPolicyEgressRule(a.(*v1beta1.NetworkPolicyEgressRule), b.(*networking.NetworkPolicyEgressRule), scope)
|
||||
}); err != nil {
|
||||
@ -1188,7 +1188,17 @@ func Convert_networking_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in *networkin
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in *v1beta1.HTTPIngressRuleValue, out *networking.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
out.Paths = *(*[]networking.HTTPIngressPath)(unsafe.Pointer(&in.Paths))
|
||||
if in.Paths != nil {
|
||||
in, out := &in.Paths, &out.Paths
|
||||
*out = make([]networking.HTTPIngressPath, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1beta1_HTTPIngressPath_To_networking_HTTPIngressPath(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Paths = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1198,7 +1208,17 @@ func Convert_v1beta1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in
|
||||
}
|
||||
|
||||
func autoConvert_networking_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in *networking.HTTPIngressRuleValue, out *v1beta1.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
out.Paths = *(*[]v1beta1.HTTPIngressPath)(unsafe.Pointer(&in.Paths))
|
||||
if in.Paths != nil {
|
||||
in, out := &in.Paths, &out.Paths
|
||||
*out = make([]v1beta1.HTTPIngressPath, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_networking_HTTPIngressPath_To_v1beta1_HTTPIngressPath(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Paths = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1296,29 +1316,18 @@ func Convert_networking_Ingress_To_v1beta1_Ingress(in *networking.Ingress, out *
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressBackend_To_networking_IngressBackend(in *v1beta1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
out.ServiceName = in.ServiceName
|
||||
out.ServicePort = in.ServicePort
|
||||
// WARNING: in.ServiceName requires manual conversion: does not exist in peer-type
|
||||
// WARNING: in.ServicePort requires manual conversion: does not exist in peer-type
|
||||
out.Resource = (*core.TypedLocalObjectReference)(unsafe.Pointer(in.Resource))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_IngressBackend_To_networking_IngressBackend is an autogenerated conversion function.
|
||||
func Convert_v1beta1_IngressBackend_To_networking_IngressBackend(in *v1beta1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_IngressBackend_To_networking_IngressBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.IngressBackend, out *v1beta1.IngressBackend, s conversion.Scope) error {
|
||||
out.ServiceName = in.ServiceName
|
||||
out.ServicePort = in.ServicePort
|
||||
// WARNING: in.Service requires manual conversion: does not exist in peer-type
|
||||
out.Resource = (*v1.TypedLocalObjectReference)(unsafe.Pointer(in.Resource))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressBackend_To_v1beta1_IngressBackend is an autogenerated conversion function.
|
||||
func Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.IngressBackend, out *v1beta1.IngressBackend, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressBackend_To_v1beta1_IngressBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressList_To_networking_IngressList(in *v1beta1.IngressList, out *networking.IngressList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
@ -1388,7 +1397,15 @@ func Convert_networking_IngressRule_To_v1beta1_IngressRule(in *networking.Ingres
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressRuleValue_To_networking_IngressRuleValue(in *v1beta1.IngressRuleValue, out *networking.IngressRuleValue, s conversion.Scope) error {
|
||||
out.HTTP = (*networking.HTTPIngressRuleValue)(unsafe.Pointer(in.HTTP))
|
||||
if in.HTTP != nil {
|
||||
in, out := &in.HTTP, &out.HTTP
|
||||
*out = new(networking.HTTPIngressRuleValue)
|
||||
if err := Convert_v1beta1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.HTTP = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1398,7 +1415,15 @@ func Convert_v1beta1_IngressRuleValue_To_networking_IngressRuleValue(in *v1beta1
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressRuleValue_To_v1beta1_IngressRuleValue(in *networking.IngressRuleValue, out *v1beta1.IngressRuleValue, s conversion.Scope) error {
|
||||
out.HTTP = (*v1beta1.HTTPIngressRuleValue)(unsafe.Pointer(in.HTTP))
|
||||
if in.HTTP != nil {
|
||||
in, out := &in.HTTP, &out.HTTP
|
||||
*out = new(v1beta1.HTTPIngressRuleValue)
|
||||
if err := Convert_networking_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.HTTP = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1409,30 +1434,40 @@ func Convert_networking_IngressRuleValue_To_v1beta1_IngressRuleValue(in *network
|
||||
|
||||
func autoConvert_v1beta1_IngressSpec_To_networking_IngressSpec(in *v1beta1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
out.IngressClassName = (*string)(unsafe.Pointer(in.IngressClassName))
|
||||
out.Backend = (*networking.IngressBackend)(unsafe.Pointer(in.Backend))
|
||||
// WARNING: in.Backend requires manual conversion: does not exist in peer-type
|
||||
out.TLS = *(*[]networking.IngressTLS)(unsafe.Pointer(&in.TLS))
|
||||
out.Rules = *(*[]networking.IngressRule)(unsafe.Pointer(&in.Rules))
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]networking.IngressRule, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1beta1_IngressRule_To_networking_IngressRule(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Rules = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_IngressSpec_To_networking_IngressSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_IngressSpec_To_networking_IngressSpec(in *v1beta1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_IngressSpec_To_networking_IngressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressSpec_To_v1beta1_IngressSpec(in *networking.IngressSpec, out *v1beta1.IngressSpec, s conversion.Scope) error {
|
||||
out.IngressClassName = (*string)(unsafe.Pointer(in.IngressClassName))
|
||||
out.Backend = (*v1beta1.IngressBackend)(unsafe.Pointer(in.Backend))
|
||||
// WARNING: in.DefaultBackend requires manual conversion: does not exist in peer-type
|
||||
out.TLS = *(*[]v1beta1.IngressTLS)(unsafe.Pointer(&in.TLS))
|
||||
out.Rules = *(*[]v1beta1.IngressRule)(unsafe.Pointer(&in.Rules))
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]v1beta1.IngressRule, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_networking_IngressRule_To_v1beta1_IngressRule(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Rules = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressSpec_To_v1beta1_IngressSpec is an autogenerated conversion function.
|
||||
func Convert_networking_IngressSpec_To_v1beta1_IngressSpec(in *networking.IngressSpec, out *v1beta1.IngressSpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressSpec_To_v1beta1_IngressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressStatus_To_networking_IngressStatus(in *v1beta1.IngressStatus, out *networking.IngressStatus, s conversion.Scope) error {
|
||||
if err := corev1.Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil {
|
||||
return err
|
||||
|
@ -49,5 +49,20 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
pathTypes := []networking.PathType{networking.PathTypeExact, networking.PathTypePrefix, networking.PathTypeImplementationSpecific}
|
||||
path.PathType = &pathTypes[c.Rand.Intn(len(pathTypes))]
|
||||
},
|
||||
func(p *networking.ServiceBackendPort, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(p)
|
||||
// clear one of the fields
|
||||
if c.RandBool() {
|
||||
p.Name = ""
|
||||
if p.Number == 0 {
|
||||
p.Number = 1
|
||||
}
|
||||
} else {
|
||||
p.Number = 0
|
||||
if p.Name == "" {
|
||||
p.Name = "portname"
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -248,26 +248,27 @@ type IngressSpec struct {
|
||||
// +optional
|
||||
IngressClassName *string
|
||||
|
||||
// Backend is a default backend capable of servicing requests that don't
|
||||
// match any rule. At least one of 'backend' or 'rules' must be specified.
|
||||
// This field is optional to allow the loadbalancer controller or defaulting
|
||||
// logic to specify a global default.
|
||||
// DefaultBackend is the backend that should handle requests that don't
|
||||
// match any rule. If Rules are not specified, DefaultBackend must be specified.
|
||||
// If DefaultBackend is not set, the handling of requests that do not match any
|
||||
// of the rules will be up to the Ingress controller.
|
||||
// +optional
|
||||
Backend *IngressBackend
|
||||
DefaultBackend *IngressBackend
|
||||
|
||||
// TLS configuration. Currently the Ingress only supports a single TLS
|
||||
// port, 443. If multiple members of this list specify different hosts, they
|
||||
// will be multiplexed on the same port according to the hostname specified
|
||||
// through the SNI TLS extension, if the ingress controller fulfilling the
|
||||
// ingress supports SNI.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
TLS []IngressTLS
|
||||
|
||||
// A list of host rules used to configure the Ingress. If unspecified, or
|
||||
// no rule matches, all traffic is sent to the default backend.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
Rules []IngressRule
|
||||
// TODO: Add the ability to specify load-balancer IP through claims
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
@ -323,6 +324,7 @@ type IngressTLS struct {
|
||||
// this list must match the name/s used in the tlsSecret. Defaults to the
|
||||
// wildcard host setting for the loadbalancer controller fulfilling this
|
||||
// Ingress, if left unspecified.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
Hosts []string
|
||||
// SecretName is the name of the secret used to terminate TLS traffic on
|
||||
@ -403,6 +405,7 @@ type IngressRuleValue struct {
|
||||
// or '#'.
|
||||
type HTTPIngressRuleValue struct {
|
||||
// A collection of paths that map requests to backends.
|
||||
// +listType=atomic
|
||||
Paths []HTTPIngressPath
|
||||
// TODO: Consider adding fields for ingress-type specific global
|
||||
// options usable by a loadbalancer, like http keep-alive.
|
||||
@ -461,17 +464,39 @@ type HTTPIngressPath struct {
|
||||
|
||||
// IngressBackend describes all endpoints for a given service and port.
|
||||
type IngressBackend struct {
|
||||
// Specifies the name of the referenced service.
|
||||
// Service references a Service as a Backend.
|
||||
// This is a mutually exclusive setting with "Resource".
|
||||
// +optional
|
||||
ServiceName string
|
||||
|
||||
// Specifies the port of the referenced service.
|
||||
// +optional
|
||||
ServicePort intstr.IntOrString
|
||||
Service *IngressServiceBackend
|
||||
|
||||
// Resource is an ObjectRef to another Kubernetes resource in the namespace
|
||||
// of the Ingress object. If resource is specified, serviceName and servicePort
|
||||
// must not be specified.
|
||||
// of the Ingress object. If resource is specified, a service.Name and
|
||||
// service.Port must not be specified.
|
||||
// This is a mutually exclusive setting with "Service".
|
||||
// +optional
|
||||
Resource *api.TypedLocalObjectReference
|
||||
}
|
||||
|
||||
// IngressServiceBackend references a Kubernetes Service as a Backend.
|
||||
type IngressServiceBackend struct {
|
||||
// Name is the referenced service. The service must exist in
|
||||
// the same namespace as the Ingress object.
|
||||
Name string
|
||||
|
||||
// Port of the referenced service. A port name or port number
|
||||
// is required for a IngressServiceBackend.
|
||||
Port ServiceBackendPort
|
||||
}
|
||||
|
||||
// ServiceBackendPort is the service port being referenced.
|
||||
type ServiceBackendPort struct {
|
||||
// Name is the name of the port on the Service.
|
||||
// This is a mutually exclusive setting with "Number".
|
||||
// +optional
|
||||
Name string
|
||||
|
||||
// Number is the numerical port number (e.g. 80) on the Service.
|
||||
// This is a mutually exclusive setting with "Name".
|
||||
// +optional
|
||||
Number int32
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ go_library(
|
||||
importpath = "k8s.io/kubernetes/pkg/apis/networking/v1",
|
||||
deps = [
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/v1:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/networking/v1:go_default_library",
|
||||
|
531
pkg/apis/networking/v1/zz_generated.conversion.go
generated
531
pkg/apis/networking/v1/zz_generated.conversion.go
generated
@ -30,6 +30,7 @@ import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
intstr "k8s.io/apimachinery/pkg/util/intstr"
|
||||
core "k8s.io/kubernetes/pkg/apis/core"
|
||||
apiscorev1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
networking "k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
@ -40,6 +41,26 @@ func init() {
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*v1.HTTPIngressPath)(nil), (*networking.HTTPIngressPath)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_HTTPIngressPath_To_networking_HTTPIngressPath(a.(*v1.HTTPIngressPath), b.(*networking.HTTPIngressPath), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.HTTPIngressPath)(nil), (*v1.HTTPIngressPath)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_HTTPIngressPath_To_v1_HTTPIngressPath(a.(*networking.HTTPIngressPath), b.(*v1.HTTPIngressPath), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.HTTPIngressRuleValue)(nil), (*networking.HTTPIngressRuleValue)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(a.(*v1.HTTPIngressRuleValue), b.(*networking.HTTPIngressRuleValue), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.HTTPIngressRuleValue)(nil), (*v1.HTTPIngressRuleValue)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue(a.(*networking.HTTPIngressRuleValue), b.(*v1.HTTPIngressRuleValue), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IPBlock)(nil), (*networking.IPBlock)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IPBlock_To_networking_IPBlock(a.(*v1.IPBlock), b.(*networking.IPBlock), scope)
|
||||
}); err != nil {
|
||||
@ -50,6 +71,126 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.Ingress)(nil), (*networking.Ingress)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_Ingress_To_networking_Ingress(a.(*v1.Ingress), b.(*networking.Ingress), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.Ingress)(nil), (*v1.Ingress)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_Ingress_To_v1_Ingress(a.(*networking.Ingress), b.(*v1.Ingress), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressBackend)(nil), (*networking.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressBackend_To_networking_IngressBackend(a.(*v1.IngressBackend), b.(*networking.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressBackend)(nil), (*v1.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressBackend_To_v1_IngressBackend(a.(*networking.IngressBackend), b.(*v1.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressClass)(nil), (*networking.IngressClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressClass_To_networking_IngressClass(a.(*v1.IngressClass), b.(*networking.IngressClass), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressClass)(nil), (*v1.IngressClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressClass_To_v1_IngressClass(a.(*networking.IngressClass), b.(*v1.IngressClass), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressClassList)(nil), (*networking.IngressClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressClassList_To_networking_IngressClassList(a.(*v1.IngressClassList), b.(*networking.IngressClassList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressClassList)(nil), (*v1.IngressClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressClassList_To_v1_IngressClassList(a.(*networking.IngressClassList), b.(*v1.IngressClassList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressClassSpec)(nil), (*networking.IngressClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressClassSpec_To_networking_IngressClassSpec(a.(*v1.IngressClassSpec), b.(*networking.IngressClassSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressClassSpec)(nil), (*v1.IngressClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressClassSpec_To_v1_IngressClassSpec(a.(*networking.IngressClassSpec), b.(*v1.IngressClassSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressList)(nil), (*networking.IngressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressList_To_networking_IngressList(a.(*v1.IngressList), b.(*networking.IngressList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressList)(nil), (*v1.IngressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressList_To_v1_IngressList(a.(*networking.IngressList), b.(*v1.IngressList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressRule)(nil), (*networking.IngressRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressRule_To_networking_IngressRule(a.(*v1.IngressRule), b.(*networking.IngressRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressRule)(nil), (*v1.IngressRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressRule_To_v1_IngressRule(a.(*networking.IngressRule), b.(*v1.IngressRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressRuleValue)(nil), (*networking.IngressRuleValue)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressRuleValue_To_networking_IngressRuleValue(a.(*v1.IngressRuleValue), b.(*networking.IngressRuleValue), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressRuleValue)(nil), (*v1.IngressRuleValue)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressRuleValue_To_v1_IngressRuleValue(a.(*networking.IngressRuleValue), b.(*v1.IngressRuleValue), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressServiceBackend)(nil), (*networking.IngressServiceBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressServiceBackend_To_networking_IngressServiceBackend(a.(*v1.IngressServiceBackend), b.(*networking.IngressServiceBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressServiceBackend)(nil), (*v1.IngressServiceBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressServiceBackend_To_v1_IngressServiceBackend(a.(*networking.IngressServiceBackend), b.(*v1.IngressServiceBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressSpec)(nil), (*networking.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressSpec_To_networking_IngressSpec(a.(*v1.IngressSpec), b.(*networking.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressSpec)(nil), (*v1.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressSpec_To_v1_IngressSpec(a.(*networking.IngressSpec), b.(*v1.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressStatus)(nil), (*networking.IngressStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressStatus_To_networking_IngressStatus(a.(*v1.IngressStatus), b.(*networking.IngressStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressStatus)(nil), (*v1.IngressStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressStatus_To_v1_IngressStatus(a.(*networking.IngressStatus), b.(*v1.IngressStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.IngressTLS)(nil), (*networking.IngressTLS)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_IngressTLS_To_networking_IngressTLS(a.(*v1.IngressTLS), b.(*networking.IngressTLS), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressTLS)(nil), (*v1.IngressTLS)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressTLS_To_v1_IngressTLS(a.(*networking.IngressTLS), b.(*v1.IngressTLS), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.NetworkPolicy)(nil), (*networking.NetworkPolicy)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_NetworkPolicy_To_networking_NetworkPolicy(a.(*v1.NetworkPolicy), b.(*networking.NetworkPolicy), scope)
|
||||
}); err != nil {
|
||||
@ -120,9 +261,67 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1.ServiceBackendPort)(nil), (*networking.ServiceBackendPort)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(a.(*v1.ServiceBackendPort), b.(*networking.ServiceBackendPort), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.ServiceBackendPort)(nil), (*v1.ServiceBackendPort)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(a.(*networking.ServiceBackendPort), b.(*v1.ServiceBackendPort), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1_HTTPIngressPath_To_networking_HTTPIngressPath(in *v1.HTTPIngressPath, out *networking.HTTPIngressPath, s conversion.Scope) error {
|
||||
out.Path = in.Path
|
||||
out.PathType = (*networking.PathType)(unsafe.Pointer(in.PathType))
|
||||
if err := Convert_v1_IngressBackend_To_networking_IngressBackend(&in.Backend, &out.Backend, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_HTTPIngressPath_To_networking_HTTPIngressPath is an autogenerated conversion function.
|
||||
func Convert_v1_HTTPIngressPath_To_networking_HTTPIngressPath(in *v1.HTTPIngressPath, out *networking.HTTPIngressPath, s conversion.Scope) error {
|
||||
return autoConvert_v1_HTTPIngressPath_To_networking_HTTPIngressPath(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_HTTPIngressPath_To_v1_HTTPIngressPath(in *networking.HTTPIngressPath, out *v1.HTTPIngressPath, s conversion.Scope) error {
|
||||
out.Path = in.Path
|
||||
out.PathType = (*v1.PathType)(unsafe.Pointer(in.PathType))
|
||||
if err := Convert_networking_IngressBackend_To_v1_IngressBackend(&in.Backend, &out.Backend, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_HTTPIngressPath_To_v1_HTTPIngressPath is an autogenerated conversion function.
|
||||
func Convert_networking_HTTPIngressPath_To_v1_HTTPIngressPath(in *networking.HTTPIngressPath, out *v1.HTTPIngressPath, s conversion.Scope) error {
|
||||
return autoConvert_networking_HTTPIngressPath_To_v1_HTTPIngressPath(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in *v1.HTTPIngressRuleValue, out *networking.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
out.Paths = *(*[]networking.HTTPIngressPath)(unsafe.Pointer(&in.Paths))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue is an autogenerated conversion function.
|
||||
func Convert_v1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in *v1.HTTPIngressRuleValue, out *networking.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
return autoConvert_v1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue(in *networking.HTTPIngressRuleValue, out *v1.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
out.Paths = *(*[]v1.HTTPIngressPath)(unsafe.Pointer(&in.Paths))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue is an autogenerated conversion function.
|
||||
func Convert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue(in *networking.HTTPIngressRuleValue, out *v1.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
return autoConvert_networking_HTTPIngressRuleValue_To_v1_HTTPIngressRuleValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IPBlock_To_networking_IPBlock(in *v1.IPBlock, out *networking.IPBlock, s conversion.Scope) error {
|
||||
out.CIDR = in.CIDR
|
||||
out.Except = *(*[]string)(unsafe.Pointer(&in.Except))
|
||||
@ -145,6 +344,316 @@ func Convert_networking_IPBlock_To_v1_IPBlock(in *networking.IPBlock, out *v1.IP
|
||||
return autoConvert_networking_IPBlock_To_v1_IPBlock(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_Ingress_To_networking_Ingress(in *v1.Ingress, out *networking.Ingress, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_IngressSpec_To_networking_IngressSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1_IngressStatus_To_networking_IngressStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_Ingress_To_networking_Ingress is an autogenerated conversion function.
|
||||
func Convert_v1_Ingress_To_networking_Ingress(in *v1.Ingress, out *networking.Ingress, s conversion.Scope) error {
|
||||
return autoConvert_v1_Ingress_To_networking_Ingress(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_Ingress_To_v1_Ingress(in *networking.Ingress, out *v1.Ingress, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_networking_IngressSpec_To_v1_IngressSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_networking_IngressStatus_To_v1_IngressStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_Ingress_To_v1_Ingress is an autogenerated conversion function.
|
||||
func Convert_networking_Ingress_To_v1_Ingress(in *networking.Ingress, out *v1.Ingress, s conversion.Scope) error {
|
||||
return autoConvert_networking_Ingress_To_v1_Ingress(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressBackend_To_networking_IngressBackend(in *v1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
out.Service = (*networking.IngressServiceBackend)(unsafe.Pointer(in.Service))
|
||||
out.Resource = (*core.TypedLocalObjectReference)(unsafe.Pointer(in.Resource))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressBackend_To_networking_IngressBackend is an autogenerated conversion function.
|
||||
func Convert_v1_IngressBackend_To_networking_IngressBackend(in *v1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressBackend_To_networking_IngressBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressBackend_To_v1_IngressBackend(in *networking.IngressBackend, out *v1.IngressBackend, s conversion.Scope) error {
|
||||
out.Service = (*v1.IngressServiceBackend)(unsafe.Pointer(in.Service))
|
||||
out.Resource = (*corev1.TypedLocalObjectReference)(unsafe.Pointer(in.Resource))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressBackend_To_v1_IngressBackend is an autogenerated conversion function.
|
||||
func Convert_networking_IngressBackend_To_v1_IngressBackend(in *networking.IngressBackend, out *v1.IngressBackend, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressBackend_To_v1_IngressBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressClass_To_networking_IngressClass(in *v1.IngressClass, out *networking.IngressClass, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_IngressClassSpec_To_networking_IngressClassSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressClass_To_networking_IngressClass is an autogenerated conversion function.
|
||||
func Convert_v1_IngressClass_To_networking_IngressClass(in *v1.IngressClass, out *networking.IngressClass, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressClass_To_networking_IngressClass(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressClass_To_v1_IngressClass(in *networking.IngressClass, out *v1.IngressClass, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_networking_IngressClassSpec_To_v1_IngressClassSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressClass_To_v1_IngressClass is an autogenerated conversion function.
|
||||
func Convert_networking_IngressClass_To_v1_IngressClass(in *networking.IngressClass, out *v1.IngressClass, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressClass_To_v1_IngressClass(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressClassList_To_networking_IngressClassList(in *v1.IngressClassList, out *networking.IngressClassList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]networking.IngressClass)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressClassList_To_networking_IngressClassList is an autogenerated conversion function.
|
||||
func Convert_v1_IngressClassList_To_networking_IngressClassList(in *v1.IngressClassList, out *networking.IngressClassList, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressClassList_To_networking_IngressClassList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressClassList_To_v1_IngressClassList(in *networking.IngressClassList, out *v1.IngressClassList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]v1.IngressClass)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressClassList_To_v1_IngressClassList is an autogenerated conversion function.
|
||||
func Convert_networking_IngressClassList_To_v1_IngressClassList(in *networking.IngressClassList, out *v1.IngressClassList, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressClassList_To_v1_IngressClassList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressClassSpec_To_networking_IngressClassSpec(in *v1.IngressClassSpec, out *networking.IngressClassSpec, s conversion.Scope) error {
|
||||
out.Controller = in.Controller
|
||||
out.Parameters = (*core.TypedLocalObjectReference)(unsafe.Pointer(in.Parameters))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressClassSpec_To_networking_IngressClassSpec is an autogenerated conversion function.
|
||||
func Convert_v1_IngressClassSpec_To_networking_IngressClassSpec(in *v1.IngressClassSpec, out *networking.IngressClassSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressClassSpec_To_networking_IngressClassSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressClassSpec_To_v1_IngressClassSpec(in *networking.IngressClassSpec, out *v1.IngressClassSpec, s conversion.Scope) error {
|
||||
out.Controller = in.Controller
|
||||
out.Parameters = (*corev1.TypedLocalObjectReference)(unsafe.Pointer(in.Parameters))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressClassSpec_To_v1_IngressClassSpec is an autogenerated conversion function.
|
||||
func Convert_networking_IngressClassSpec_To_v1_IngressClassSpec(in *networking.IngressClassSpec, out *v1.IngressClassSpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressClassSpec_To_v1_IngressClassSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressList_To_networking_IngressList(in *v1.IngressList, out *networking.IngressList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]networking.Ingress, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1_Ingress_To_networking_Ingress(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressList_To_networking_IngressList is an autogenerated conversion function.
|
||||
func Convert_v1_IngressList_To_networking_IngressList(in *v1.IngressList, out *networking.IngressList, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressList_To_networking_IngressList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressList_To_v1_IngressList(in *networking.IngressList, out *v1.IngressList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]v1.Ingress, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_networking_Ingress_To_v1_Ingress(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressList_To_v1_IngressList is an autogenerated conversion function.
|
||||
func Convert_networking_IngressList_To_v1_IngressList(in *networking.IngressList, out *v1.IngressList, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressList_To_v1_IngressList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressRule_To_networking_IngressRule(in *v1.IngressRule, out *networking.IngressRule, s conversion.Scope) error {
|
||||
out.Host = in.Host
|
||||
if err := Convert_v1_IngressRuleValue_To_networking_IngressRuleValue(&in.IngressRuleValue, &out.IngressRuleValue, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressRule_To_networking_IngressRule is an autogenerated conversion function.
|
||||
func Convert_v1_IngressRule_To_networking_IngressRule(in *v1.IngressRule, out *networking.IngressRule, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressRule_To_networking_IngressRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressRule_To_v1_IngressRule(in *networking.IngressRule, out *v1.IngressRule, s conversion.Scope) error {
|
||||
out.Host = in.Host
|
||||
if err := Convert_networking_IngressRuleValue_To_v1_IngressRuleValue(&in.IngressRuleValue, &out.IngressRuleValue, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressRule_To_v1_IngressRule is an autogenerated conversion function.
|
||||
func Convert_networking_IngressRule_To_v1_IngressRule(in *networking.IngressRule, out *v1.IngressRule, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressRule_To_v1_IngressRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressRuleValue_To_networking_IngressRuleValue(in *v1.IngressRuleValue, out *networking.IngressRuleValue, s conversion.Scope) error {
|
||||
out.HTTP = (*networking.HTTPIngressRuleValue)(unsafe.Pointer(in.HTTP))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressRuleValue_To_networking_IngressRuleValue is an autogenerated conversion function.
|
||||
func Convert_v1_IngressRuleValue_To_networking_IngressRuleValue(in *v1.IngressRuleValue, out *networking.IngressRuleValue, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressRuleValue_To_networking_IngressRuleValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressRuleValue_To_v1_IngressRuleValue(in *networking.IngressRuleValue, out *v1.IngressRuleValue, s conversion.Scope) error {
|
||||
out.HTTP = (*v1.HTTPIngressRuleValue)(unsafe.Pointer(in.HTTP))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressRuleValue_To_v1_IngressRuleValue is an autogenerated conversion function.
|
||||
func Convert_networking_IngressRuleValue_To_v1_IngressRuleValue(in *networking.IngressRuleValue, out *v1.IngressRuleValue, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressRuleValue_To_v1_IngressRuleValue(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressServiceBackend_To_networking_IngressServiceBackend(in *v1.IngressServiceBackend, out *networking.IngressServiceBackend, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
if err := Convert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(&in.Port, &out.Port, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressServiceBackend_To_networking_IngressServiceBackend is an autogenerated conversion function.
|
||||
func Convert_v1_IngressServiceBackend_To_networking_IngressServiceBackend(in *v1.IngressServiceBackend, out *networking.IngressServiceBackend, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressServiceBackend_To_networking_IngressServiceBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressServiceBackend_To_v1_IngressServiceBackend(in *networking.IngressServiceBackend, out *v1.IngressServiceBackend, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
if err := Convert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(&in.Port, &out.Port, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressServiceBackend_To_v1_IngressServiceBackend is an autogenerated conversion function.
|
||||
func Convert_networking_IngressServiceBackend_To_v1_IngressServiceBackend(in *networking.IngressServiceBackend, out *v1.IngressServiceBackend, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressServiceBackend_To_v1_IngressServiceBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressSpec_To_networking_IngressSpec(in *v1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
out.IngressClassName = (*string)(unsafe.Pointer(in.IngressClassName))
|
||||
out.DefaultBackend = (*networking.IngressBackend)(unsafe.Pointer(in.DefaultBackend))
|
||||
out.TLS = *(*[]networking.IngressTLS)(unsafe.Pointer(&in.TLS))
|
||||
out.Rules = *(*[]networking.IngressRule)(unsafe.Pointer(&in.Rules))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressSpec_To_networking_IngressSpec is an autogenerated conversion function.
|
||||
func Convert_v1_IngressSpec_To_networking_IngressSpec(in *v1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressSpec_To_networking_IngressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressSpec_To_v1_IngressSpec(in *networking.IngressSpec, out *v1.IngressSpec, s conversion.Scope) error {
|
||||
out.IngressClassName = (*string)(unsafe.Pointer(in.IngressClassName))
|
||||
out.DefaultBackend = (*v1.IngressBackend)(unsafe.Pointer(in.DefaultBackend))
|
||||
out.TLS = *(*[]v1.IngressTLS)(unsafe.Pointer(&in.TLS))
|
||||
out.Rules = *(*[]v1.IngressRule)(unsafe.Pointer(&in.Rules))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressSpec_To_v1_IngressSpec is an autogenerated conversion function.
|
||||
func Convert_networking_IngressSpec_To_v1_IngressSpec(in *networking.IngressSpec, out *v1.IngressSpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressSpec_To_v1_IngressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressStatus_To_networking_IngressStatus(in *v1.IngressStatus, out *networking.IngressStatus, s conversion.Scope) error {
|
||||
if err := apiscorev1.Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressStatus_To_networking_IngressStatus is an autogenerated conversion function.
|
||||
func Convert_v1_IngressStatus_To_networking_IngressStatus(in *v1.IngressStatus, out *networking.IngressStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressStatus_To_networking_IngressStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressStatus_To_v1_IngressStatus(in *networking.IngressStatus, out *v1.IngressStatus, s conversion.Scope) error {
|
||||
if err := apiscorev1.Convert_core_LoadBalancerStatus_To_v1_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressStatus_To_v1_IngressStatus is an autogenerated conversion function.
|
||||
func Convert_networking_IngressStatus_To_v1_IngressStatus(in *networking.IngressStatus, out *v1.IngressStatus, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressStatus_To_v1_IngressStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_IngressTLS_To_networking_IngressTLS(in *v1.IngressTLS, out *networking.IngressTLS, s conversion.Scope) error {
|
||||
out.Hosts = *(*[]string)(unsafe.Pointer(&in.Hosts))
|
||||
out.SecretName = in.SecretName
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_IngressTLS_To_networking_IngressTLS is an autogenerated conversion function.
|
||||
func Convert_v1_IngressTLS_To_networking_IngressTLS(in *v1.IngressTLS, out *networking.IngressTLS, s conversion.Scope) error {
|
||||
return autoConvert_v1_IngressTLS_To_networking_IngressTLS(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressTLS_To_v1_IngressTLS(in *networking.IngressTLS, out *v1.IngressTLS, s conversion.Scope) error {
|
||||
out.Hosts = *(*[]string)(unsafe.Pointer(&in.Hosts))
|
||||
out.SecretName = in.SecretName
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressTLS_To_v1_IngressTLS is an autogenerated conversion function.
|
||||
func Convert_networking_IngressTLS_To_v1_IngressTLS(in *networking.IngressTLS, out *v1.IngressTLS, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressTLS_To_v1_IngressTLS(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_NetworkPolicy_To_networking_NetworkPolicy(in *v1.NetworkPolicy, out *networking.NetworkPolicy, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_NetworkPolicySpec_To_networking_NetworkPolicySpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
@ -308,3 +817,25 @@ func autoConvert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in *networ
|
||||
func Convert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in *networking.NetworkPolicySpec, out *v1.NetworkPolicySpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_NetworkPolicySpec_To_v1_NetworkPolicySpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(in *v1.ServiceBackendPort, out *networking.ServiceBackendPort, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.Number = in.Number
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_ServiceBackendPort_To_networking_ServiceBackendPort is an autogenerated conversion function.
|
||||
func Convert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(in *v1.ServiceBackendPort, out *networking.ServiceBackendPort, s conversion.Scope) error {
|
||||
return autoConvert_v1_ServiceBackendPort_To_networking_ServiceBackendPort(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(in *networking.ServiceBackendPort, out *v1.ServiceBackendPort, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.Number = in.Number
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_ServiceBackendPort_To_v1_ServiceBackendPort is an autogenerated conversion function.
|
||||
func Convert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(in *networking.ServiceBackendPort, out *v1.ServiceBackendPort, s conversion.Scope) error {
|
||||
return autoConvert_networking_ServiceBackendPort_To_v1_ServiceBackendPort(in, out, s)
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"conversion.go",
|
||||
"defaults.go",
|
||||
"doc.go",
|
||||
"register.go",
|
||||
@ -21,6 +22,7 @@ go_library(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@ -39,13 +41,20 @@ filegroup(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["defaults_test.go"],
|
||||
srcs = [
|
||||
"conversion_test.go",
|
||||
"defaults_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//pkg/apis/networking/install:go_default_library",
|
||||
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
||||
],
|
||||
)
|
||||
|
77
pkg/apis/networking/v1beta1/conversion.go
Normal file
77
pkg/apis/networking/v1beta1/conversion.go
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1beta1 "k8s.io/api/networking/v1beta1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
networking "k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
func Convert_v1beta1_IngressBackend_To_networking_IngressBackend(in *v1beta1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
if err := autoConvert_v1beta1_IngressBackend_To_networking_IngressBackend(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if len(in.ServiceName) > 0 || in.ServicePort.IntVal != 0 || in.ServicePort.StrVal != "" || in.ServicePort.Type == intstr.String {
|
||||
out.Service = &networking.IngressServiceBackend{}
|
||||
out.Service.Name = in.ServiceName
|
||||
out.Service.Port.Name = in.ServicePort.StrVal
|
||||
out.Service.Port.Number = in.ServicePort.IntVal
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.IngressBackend, out *v1beta1.IngressBackend, s conversion.Scope) error {
|
||||
if err := autoConvert_networking_IngressBackend_To_v1beta1_IngressBackend(in, out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Service != nil {
|
||||
out.ServiceName = in.Service.Name
|
||||
if len(in.Service.Port.Name) > 0 {
|
||||
out.ServicePort = intstr.FromString(in.Service.Port.Name)
|
||||
} else {
|
||||
out.ServicePort = intstr.FromInt(int(in.Service.Port.Number))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func Convert_v1beta1_IngressSpec_To_networking_IngressSpec(in *v1beta1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
if err := autoConvert_v1beta1_IngressSpec_To_networking_IngressSpec(in, out, s); err != nil {
|
||||
return nil
|
||||
}
|
||||
if in.Backend != nil {
|
||||
out.DefaultBackend = &networking.IngressBackend{}
|
||||
if err := Convert_v1beta1_IngressBackend_To_networking_IngressBackend(in.Backend, out.DefaultBackend, s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_networking_IngressSpec_To_v1beta1_IngressSpec(in *networking.IngressSpec, out *v1beta1.IngressSpec, s conversion.Scope) error {
|
||||
if err := autoConvert_networking_IngressSpec_To_v1beta1_IngressSpec(in, out, s); err != nil {
|
||||
return nil
|
||||
}
|
||||
if in.DefaultBackend != nil {
|
||||
out.Backend = &v1beta1.IngressBackend{}
|
||||
if err := Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in.DefaultBackend, out.Backend, s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
108
pkg/apis/networking/v1beta1/conversion_test.go
Normal file
108
pkg/apis/networking/v1beta1/conversion_test.go
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
Copyright 2019 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"k8s.io/api/networking/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
func TestIngressBackendConversion(t *testing.T) {
|
||||
scheme := runtime.NewScheme()
|
||||
assert.NoError(t, RegisterConversions(scheme))
|
||||
|
||||
tests := map[string]struct {
|
||||
external v1beta1.IngressSpec
|
||||
internal networking.IngressSpec
|
||||
}{
|
||||
"service-port-number": {
|
||||
external: v1beta1.IngressSpec{
|
||||
Backend: &v1beta1.IngressBackend{
|
||||
ServiceName: "test-backend",
|
||||
ServicePort: intstr.FromInt(8080),
|
||||
},
|
||||
},
|
||||
internal: networking.IngressSpec{
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "test-backend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "",
|
||||
Number: 8080,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"service-named-port": {
|
||||
external: v1beta1.IngressSpec{
|
||||
Backend: &v1beta1.IngressBackend{
|
||||
ServiceName: "test-backend",
|
||||
ServicePort: intstr.FromString("https"),
|
||||
},
|
||||
},
|
||||
internal: networking.IngressSpec{
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "test-backend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "https",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"empty-service-name": {
|
||||
external: v1beta1.IngressSpec{
|
||||
Backend: &v1beta1.IngressBackend{
|
||||
ServiceName: "",
|
||||
ServicePort: intstr.FromString("https"),
|
||||
},
|
||||
},
|
||||
internal: networking.IngressSpec{
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "https",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, test := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
convertedInternal := networking.IngressSpec{}
|
||||
require.NoError(t,
|
||||
Convert_v1beta1_IngressSpec_To_networking_IngressSpec(&test.external, &convertedInternal, nil))
|
||||
assert.Equal(t, test.internal, convertedInternal, "v1beta1.IngressSpec -> networking.IngressSpec")
|
||||
|
||||
convertedV1beta1 := v1beta1.IngressSpec{}
|
||||
require.NoError(t,
|
||||
Convert_networking_IngressSpec_To_v1beta1_IngressSpec(&test.internal, &convertedV1beta1, nil))
|
||||
assert.Equal(t, test.external, convertedV1beta1, "networking.IngressSpec -> v1beta1.IngressSpec")
|
||||
})
|
||||
}
|
||||
}
|
139
pkg/apis/networking/v1beta1/zz_generated.conversion.go
generated
139
pkg/apis/networking/v1beta1/zz_generated.conversion.go
generated
@ -69,16 +69,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressBackend)(nil), (*networking.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressBackend_To_networking_IngressBackend(a.(*v1beta1.IngressBackend), b.(*networking.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressBackend)(nil), (*v1beta1.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressBackend_To_v1beta1_IngressBackend(a.(*networking.IngressBackend), b.(*v1beta1.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressClass)(nil), (*networking.IngressClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressClass_To_networking_IngressClass(a.(*v1beta1.IngressClass), b.(*networking.IngressClass), scope)
|
||||
}); err != nil {
|
||||
@ -139,16 +129,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressSpec)(nil), (*networking.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressSpec_To_networking_IngressSpec(a.(*v1beta1.IngressSpec), b.(*networking.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*networking.IngressSpec)(nil), (*v1beta1.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressSpec_To_v1beta1_IngressSpec(a.(*networking.IngressSpec), b.(*v1beta1.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.IngressStatus)(nil), (*networking.IngressStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressStatus_To_networking_IngressStatus(a.(*v1beta1.IngressStatus), b.(*networking.IngressStatus), scope)
|
||||
}); err != nil {
|
||||
@ -169,6 +149,26 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*networking.IngressBackend)(nil), (*v1beta1.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressBackend_To_v1beta1_IngressBackend(a.(*networking.IngressBackend), b.(*v1beta1.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*networking.IngressSpec)(nil), (*v1beta1.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_networking_IngressSpec_To_v1beta1_IngressSpec(a.(*networking.IngressSpec), b.(*v1beta1.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.IngressBackend)(nil), (*networking.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressBackend_To_networking_IngressBackend(a.(*v1beta1.IngressBackend), b.(*networking.IngressBackend), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1beta1.IngressSpec)(nil), (*networking.IngressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_IngressSpec_To_networking_IngressSpec(a.(*v1beta1.IngressSpec), b.(*networking.IngressSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -201,7 +201,17 @@ func Convert_networking_HTTPIngressPath_To_v1beta1_HTTPIngressPath(in *networkin
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in *v1beta1.HTTPIngressRuleValue, out *networking.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
out.Paths = *(*[]networking.HTTPIngressPath)(unsafe.Pointer(&in.Paths))
|
||||
if in.Paths != nil {
|
||||
in, out := &in.Paths, &out.Paths
|
||||
*out = make([]networking.HTTPIngressPath, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1beta1_HTTPIngressPath_To_networking_HTTPIngressPath(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Paths = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -211,7 +221,17 @@ func Convert_v1beta1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(in
|
||||
}
|
||||
|
||||
func autoConvert_networking_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in *networking.HTTPIngressRuleValue, out *v1beta1.HTTPIngressRuleValue, s conversion.Scope) error {
|
||||
out.Paths = *(*[]v1beta1.HTTPIngressPath)(unsafe.Pointer(&in.Paths))
|
||||
if in.Paths != nil {
|
||||
in, out := &in.Paths, &out.Paths
|
||||
*out = make([]v1beta1.HTTPIngressPath, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_networking_HTTPIngressPath_To_v1beta1_HTTPIngressPath(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Paths = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -253,29 +273,18 @@ func Convert_networking_Ingress_To_v1beta1_Ingress(in *networking.Ingress, out *
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressBackend_To_networking_IngressBackend(in *v1beta1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
out.ServiceName = in.ServiceName
|
||||
out.ServicePort = in.ServicePort
|
||||
// WARNING: in.ServiceName requires manual conversion: does not exist in peer-type
|
||||
// WARNING: in.ServicePort requires manual conversion: does not exist in peer-type
|
||||
out.Resource = (*core.TypedLocalObjectReference)(unsafe.Pointer(in.Resource))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_IngressBackend_To_networking_IngressBackend is an autogenerated conversion function.
|
||||
func Convert_v1beta1_IngressBackend_To_networking_IngressBackend(in *v1beta1.IngressBackend, out *networking.IngressBackend, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_IngressBackend_To_networking_IngressBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.IngressBackend, out *v1beta1.IngressBackend, s conversion.Scope) error {
|
||||
out.ServiceName = in.ServiceName
|
||||
out.ServicePort = in.ServicePort
|
||||
// WARNING: in.Service requires manual conversion: does not exist in peer-type
|
||||
out.Resource = (*v1.TypedLocalObjectReference)(unsafe.Pointer(in.Resource))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressBackend_To_v1beta1_IngressBackend is an autogenerated conversion function.
|
||||
func Convert_networking_IngressBackend_To_v1beta1_IngressBackend(in *networking.IngressBackend, out *v1beta1.IngressBackend, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressBackend_To_v1beta1_IngressBackend(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressClass_To_networking_IngressClass(in *v1beta1.IngressClass, out *networking.IngressClass, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_IngressClassSpec_To_networking_IngressClassSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
@ -415,7 +424,15 @@ func Convert_networking_IngressRule_To_v1beta1_IngressRule(in *networking.Ingres
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressRuleValue_To_networking_IngressRuleValue(in *v1beta1.IngressRuleValue, out *networking.IngressRuleValue, s conversion.Scope) error {
|
||||
out.HTTP = (*networking.HTTPIngressRuleValue)(unsafe.Pointer(in.HTTP))
|
||||
if in.HTTP != nil {
|
||||
in, out := &in.HTTP, &out.HTTP
|
||||
*out = new(networking.HTTPIngressRuleValue)
|
||||
if err := Convert_v1beta1_HTTPIngressRuleValue_To_networking_HTTPIngressRuleValue(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.HTTP = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -425,7 +442,15 @@ func Convert_v1beta1_IngressRuleValue_To_networking_IngressRuleValue(in *v1beta1
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressRuleValue_To_v1beta1_IngressRuleValue(in *networking.IngressRuleValue, out *v1beta1.IngressRuleValue, s conversion.Scope) error {
|
||||
out.HTTP = (*v1beta1.HTTPIngressRuleValue)(unsafe.Pointer(in.HTTP))
|
||||
if in.HTTP != nil {
|
||||
in, out := &in.HTTP, &out.HTTP
|
||||
*out = new(v1beta1.HTTPIngressRuleValue)
|
||||
if err := Convert_networking_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(*in, *out, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.HTTP = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -436,30 +461,40 @@ func Convert_networking_IngressRuleValue_To_v1beta1_IngressRuleValue(in *network
|
||||
|
||||
func autoConvert_v1beta1_IngressSpec_To_networking_IngressSpec(in *v1beta1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
out.IngressClassName = (*string)(unsafe.Pointer(in.IngressClassName))
|
||||
out.Backend = (*networking.IngressBackend)(unsafe.Pointer(in.Backend))
|
||||
// WARNING: in.Backend requires manual conversion: does not exist in peer-type
|
||||
out.TLS = *(*[]networking.IngressTLS)(unsafe.Pointer(&in.TLS))
|
||||
out.Rules = *(*[]networking.IngressRule)(unsafe.Pointer(&in.Rules))
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]networking.IngressRule, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1beta1_IngressRule_To_networking_IngressRule(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Rules = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_IngressSpec_To_networking_IngressSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_IngressSpec_To_networking_IngressSpec(in *v1beta1.IngressSpec, out *networking.IngressSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_IngressSpec_To_networking_IngressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_networking_IngressSpec_To_v1beta1_IngressSpec(in *networking.IngressSpec, out *v1beta1.IngressSpec, s conversion.Scope) error {
|
||||
out.IngressClassName = (*string)(unsafe.Pointer(in.IngressClassName))
|
||||
out.Backend = (*v1beta1.IngressBackend)(unsafe.Pointer(in.Backend))
|
||||
// WARNING: in.DefaultBackend requires manual conversion: does not exist in peer-type
|
||||
out.TLS = *(*[]v1beta1.IngressTLS)(unsafe.Pointer(&in.TLS))
|
||||
out.Rules = *(*[]v1beta1.IngressRule)(unsafe.Pointer(&in.Rules))
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]v1beta1.IngressRule, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_networking_IngressRule_To_v1beta1_IngressRule(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Rules = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_networking_IngressSpec_To_v1beta1_IngressSpec is an autogenerated conversion function.
|
||||
func Convert_networking_IngressSpec_To_v1beta1_IngressSpec(in *networking.IngressSpec, out *v1beta1.IngressSpec, s conversion.Scope) error {
|
||||
return autoConvert_networking_IngressSpec_To_v1beta1_IngressSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_IngressStatus_To_networking_IngressStatus(in *v1beta1.IngressStatus, out *networking.IngressStatus, s conversion.Scope) error {
|
||||
if err := corev1.Convert_v1_LoadBalancerStatus_To_core_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil {
|
||||
return err
|
||||
|
@ -43,6 +43,8 @@ go_library(
|
||||
"//pkg/apis/core/validation:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//pkg/features:go_default_library",
|
||||
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/validation:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/validation/path:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library",
|
||||
|
@ -21,6 +21,8 @@ import (
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
|
||||
pathvalidation "k8s.io/apimachinery/pkg/api/validation/path"
|
||||
unversionedvalidation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
|
||||
@ -251,18 +253,29 @@ func validateIngressTLS(spec *networking.IngressSpec, fldPath *field.Path) field
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// defaultBackendFieldName returns the name of the field used for defaultBackend
|
||||
// in the provided GroupVersion.
|
||||
func defaultBackendFieldName(gv schema.GroupVersion) string {
|
||||
switch gv {
|
||||
case networkingv1beta1.SchemeGroupVersion, extensionsv1beta1.SchemeGroupVersion:
|
||||
return "backend"
|
||||
default:
|
||||
return "defaultBackend"
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateIngressSpec tests if required fields in the IngressSpec are set.
|
||||
func ValidateIngressSpec(spec *networking.IngressSpec, fldPath *field.Path, opts IngressValidationOptions, requestGV schema.GroupVersion) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if len(spec.Rules) == 0 && spec.Backend == nil {
|
||||
errMsg := "either `backend` or `rules` must be specified"
|
||||
if len(spec.Rules) == 0 && spec.DefaultBackend == nil {
|
||||
errMsg := fmt.Sprintf("either `%s` or `rules` must be specified", defaultBackendFieldName(requestGV))
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, spec.Rules, errMsg))
|
||||
}
|
||||
if spec.Backend != nil {
|
||||
allErrs = append(allErrs, validateIngressBackend(spec.Backend, fldPath.Child("backend"), opts)...)
|
||||
if spec.DefaultBackend != nil {
|
||||
allErrs = append(allErrs, validateIngressBackend(spec.DefaultBackend, fldPath.Child(defaultBackendFieldName(requestGV)), opts, requestGV)...)
|
||||
}
|
||||
if len(spec.Rules) > 0 {
|
||||
allErrs = append(allErrs, validateIngressRules(spec.Rules, fldPath.Child("rules"), opts)...)
|
||||
allErrs = append(allErrs, validateIngressRules(spec.Rules, fldPath.Child("rules"), opts, requestGV)...)
|
||||
}
|
||||
if len(spec.TLS) > 0 {
|
||||
allErrs = append(allErrs, validateIngressTLS(spec, fldPath.Child("tls"))...)
|
||||
@ -282,7 +295,7 @@ func ValidateIngressStatusUpdate(ingress, oldIngress *networking.Ingress) field.
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateIngressRules(ingressRules []networking.IngressRule, fldPath *field.Path, opts IngressValidationOptions) field.ErrorList {
|
||||
func validateIngressRules(ingressRules []networking.IngressRule, fldPath *field.Path, opts IngressValidationOptions, requestGV schema.GroupVersion) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if len(ingressRules) == 0 {
|
||||
return append(allErrs, field.Required(fldPath, ""))
|
||||
@ -304,31 +317,31 @@ func validateIngressRules(ingressRules []networking.IngressRule, fldPath *field.
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Index(i).Child("host"), ih.Host, msg))
|
||||
}
|
||||
}
|
||||
allErrs = append(allErrs, validateIngressRuleValue(&ih.IngressRuleValue, fldPath.Index(0), opts)...)
|
||||
allErrs = append(allErrs, validateIngressRuleValue(&ih.IngressRuleValue, fldPath.Index(0), opts, requestGV)...)
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateIngressRuleValue(ingressRule *networking.IngressRuleValue, fldPath *field.Path, opts IngressValidationOptions) field.ErrorList {
|
||||
func validateIngressRuleValue(ingressRule *networking.IngressRuleValue, fldPath *field.Path, opts IngressValidationOptions, requestGV schema.GroupVersion) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if ingressRule.HTTP != nil {
|
||||
allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP, fldPath.Child("http"), opts)...)
|
||||
allErrs = append(allErrs, validateHTTPIngressRuleValue(ingressRule.HTTP, fldPath.Child("http"), opts, requestGV)...)
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateHTTPIngressRuleValue(httpIngressRuleValue *networking.HTTPIngressRuleValue, fldPath *field.Path, opts IngressValidationOptions) field.ErrorList {
|
||||
func validateHTTPIngressRuleValue(httpIngressRuleValue *networking.HTTPIngressRuleValue, fldPath *field.Path, opts IngressValidationOptions, requestGV schema.GroupVersion) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if len(httpIngressRuleValue.Paths) == 0 {
|
||||
allErrs = append(allErrs, field.Required(fldPath.Child("paths"), ""))
|
||||
}
|
||||
for i, path := range httpIngressRuleValue.Paths {
|
||||
allErrs = append(allErrs, validateHTTPIngressPath(&path, fldPath.Child("paths").Index(i), opts)...)
|
||||
allErrs = append(allErrs, validateHTTPIngressPath(&path, fldPath.Child("paths").Index(i), opts, requestGV)...)
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateHTTPIngressPath(path *networking.HTTPIngressPath, fldPath *field.Path, opts IngressValidationOptions) field.ErrorList {
|
||||
func validateHTTPIngressPath(path *networking.HTTPIngressPath, fldPath *field.Path, opts IngressValidationOptions, requestGV schema.GroupVersion) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
|
||||
if path.PathType == nil {
|
||||
@ -362,32 +375,82 @@ func validateHTTPIngressPath(path *networking.HTTPIngressPath, fldPath *field.Pa
|
||||
default:
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath.Child("pathType"), *path.PathType, supportedPathTypes.List()))
|
||||
}
|
||||
|
||||
allErrs = append(allErrs, validateIngressBackend(&path.Backend, fldPath.Child("backend"), opts)...)
|
||||
allErrs = append(allErrs, validateIngressBackend(&path.Backend, fldPath.Child("backend"), opts, requestGV)...)
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// numberPortField returns the field path to a service port number field
|
||||
// relative to a backend struct in the provided GroupVersion
|
||||
func numberPortField(numberPortFieldPath *field.Path, gv schema.GroupVersion) *field.Path {
|
||||
switch gv {
|
||||
case networkingv1beta1.SchemeGroupVersion, extensionsv1beta1.SchemeGroupVersion:
|
||||
return numberPortFieldPath.Child("servicePort")
|
||||
default:
|
||||
return numberPortFieldPath.Child("service", "port", "number")
|
||||
}
|
||||
}
|
||||
|
||||
// namedPortField returns the field path to a service port name field
|
||||
// relative to a backend struct in the provided GroupVersion
|
||||
func namedPortField(namedPortFieldPath *field.Path, gv schema.GroupVersion) *field.Path {
|
||||
switch gv {
|
||||
case networkingv1beta1.SchemeGroupVersion, extensionsv1beta1.SchemeGroupVersion:
|
||||
return namedPortFieldPath.Child("servicePort")
|
||||
default:
|
||||
return namedPortFieldPath.Child("service", "port", "name")
|
||||
}
|
||||
}
|
||||
|
||||
// serviceNameFieldPath returns the name of the field used for a
|
||||
// service name in the provided GroupVersion.
|
||||
func serviceNameFieldPath(backendFieldPath *field.Path, gv schema.GroupVersion) *field.Path {
|
||||
switch gv {
|
||||
case networkingv1beta1.SchemeGroupVersion, extensionsv1beta1.SchemeGroupVersion:
|
||||
return backendFieldPath.Child("serviceName")
|
||||
default:
|
||||
return backendFieldPath.Child("service", "name")
|
||||
}
|
||||
}
|
||||
|
||||
// validateIngressBackend tests if a given backend is valid.
|
||||
func validateIngressBackend(backend *networking.IngressBackend, fldPath *field.Path, opts IngressValidationOptions) field.ErrorList {
|
||||
func validateIngressBackend(backend *networking.IngressBackend, fldPath *field.Path, opts IngressValidationOptions, requestGV schema.GroupVersion) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
|
||||
hasResourceBackend := backend.Resource != nil
|
||||
hasServiceBackend := len(backend.ServiceName) > 0 || backend.ServicePort.IntVal != 0 || len(backend.ServicePort.StrVal) > 0
|
||||
hasServiceBackend := backend.Service != nil
|
||||
|
||||
switch {
|
||||
case hasResourceBackend && hasServiceBackend:
|
||||
return append(allErrs, field.Invalid(fldPath, "", "cannot set both resource and service backends"))
|
||||
case hasResourceBackend:
|
||||
allErrs = append(allErrs, validateIngressTypedLocalObjectReference(backend.Resource, fldPath.Child("resource"))...)
|
||||
default:
|
||||
if len(backend.ServiceName) == 0 {
|
||||
return append(allErrs, field.Required(fldPath.Child("serviceName"), ""))
|
||||
}
|
||||
for _, msg := range apivalidation.ValidateServiceName(backend.ServiceName, false) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("serviceName"), backend.ServiceName, msg))
|
||||
}
|
||||
allErrs = append(allErrs, apivalidation.ValidatePortNumOrName(backend.ServicePort, fldPath.Child("servicePort"))...)
|
||||
case hasServiceBackend:
|
||||
|
||||
if len(backend.Service.Name) == 0 {
|
||||
allErrs = append(allErrs, field.Required(serviceNameFieldPath(fldPath, requestGV), ""))
|
||||
} else {
|
||||
for _, msg := range apivalidation.ValidateServiceName(backend.Service.Name, false) {
|
||||
allErrs = append(allErrs, field.Invalid(serviceNameFieldPath(fldPath, requestGV), backend.Service.Name, msg))
|
||||
}
|
||||
}
|
||||
|
||||
hasPortName := len(backend.Service.Port.Name) > 0
|
||||
hasPortNumber := backend.Service.Port.Number != 0
|
||||
if hasPortName && hasPortNumber {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, "", "cannot set both port name & port number"))
|
||||
} else if hasPortName {
|
||||
for _, msg := range validation.IsValidPortName(backend.Service.Port.Name) {
|
||||
allErrs = append(allErrs, field.Invalid(namedPortField(fldPath, requestGV), backend.Service.Port.Name, msg))
|
||||
}
|
||||
} else if hasPortNumber {
|
||||
for _, msg := range validation.IsValidPortNum(int(backend.Service.Port.Number)) {
|
||||
allErrs = append(allErrs, field.Invalid(numberPortField(fldPath, requestGV), backend.Service.Port.Number, msg))
|
||||
}
|
||||
} else {
|
||||
allErrs = append(allErrs, field.Required(fldPath, "port name or number is required"))
|
||||
}
|
||||
default:
|
||||
allErrs = append(allErrs, field.Invalid(fldPath, "", "resource or service backend is required"))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
@ -896,9 +896,15 @@ func TestValidateNetworkPolicyUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateIngress(t *testing.T) {
|
||||
serviceBackend := &networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "",
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
defaultBackend := networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: serviceBackend,
|
||||
}
|
||||
pathTypePrefix := networking.PathTypePrefix
|
||||
pathTypeImplementationSpecific := networking.PathTypeImplementationSpecific
|
||||
@ -910,10 +916,7 @@ func TestValidateIngress(t *testing.T) {
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
},
|
||||
DefaultBackend: &defaultBackend,
|
||||
Rules: []networking.IngressRule{
|
||||
{
|
||||
Host: "foo.bar.com",
|
||||
@ -961,7 +964,7 @@ func TestValidateIngress(t *testing.T) {
|
||||
"backend (v1beta1) with no service": {
|
||||
groupVersion: &networkingv1beta1.SchemeGroupVersion,
|
||||
tweakIngress: func(ing *networking.Ingress) {
|
||||
ing.Spec.Backend.ServiceName = ""
|
||||
ing.Spec.DefaultBackend.Service.Name = ""
|
||||
},
|
||||
expectErrsOnFields: []string{
|
||||
"spec.backend.serviceName",
|
||||
@ -1039,7 +1042,7 @@ func TestValidateIngress(t *testing.T) {
|
||||
Path: "/foo",
|
||||
PathType: &pathTypeImplementationSpecific,
|
||||
Backend: networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
Service: serviceBackend,
|
||||
Resource: &api.TypedLocalObjectReference{
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
Kind: "foo",
|
||||
@ -1064,7 +1067,7 @@ func TestValidateIngress(t *testing.T) {
|
||||
Path: "/foo",
|
||||
PathType: &pathTypeImplementationSpecific,
|
||||
Backend: networking.IngressBackend{
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: serviceBackend,
|
||||
Resource: &api.TypedLocalObjectReference{
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
Kind: "foo",
|
||||
@ -1083,8 +1086,8 @@ func TestValidateIngress(t *testing.T) {
|
||||
"spec.backend resource and service name are not allowed together": {
|
||||
groupVersion: &networkingv1beta1.SchemeGroupVersion,
|
||||
tweakIngress: func(ing *networking.Ingress) {
|
||||
ing.Spec.Backend = &networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ing.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Service: serviceBackend,
|
||||
Resource: &api.TypedLocalObjectReference{
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
Kind: "foo",
|
||||
@ -1099,8 +1102,8 @@ func TestValidateIngress(t *testing.T) {
|
||||
"spec.backend resource and service port are not allowed together": {
|
||||
groupVersion: &networkingv1beta1.SchemeGroupVersion,
|
||||
tweakIngress: func(ing *networking.Ingress) {
|
||||
ing.Spec.Backend = &networking.IngressBackend{
|
||||
ServicePort: intstr.FromInt(80),
|
||||
ing.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Service: serviceBackend,
|
||||
Resource: &api.TypedLocalObjectReference{
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
Kind: "foo",
|
||||
@ -1136,8 +1139,16 @@ func TestValidateIngress(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateIngressRuleValue(t *testing.T) {
|
||||
serviceBackend := networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "",
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
fldPath := field.NewPath("testing.http.paths[0].path")
|
||||
testCases := map[string]struct {
|
||||
groupVersion *schema.GroupVersion
|
||||
pathType networking.PathType
|
||||
path string
|
||||
expectedErrs field.ErrorList
|
||||
@ -1233,16 +1244,17 @@ func TestValidateIngressRuleValue(t *testing.T) {
|
||||
Path: testCase.path,
|
||||
PathType: &testCase.pathType,
|
||||
Backend: networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: &serviceBackend,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
errs := validateIngressRuleValue(irv, field.NewPath("testing"), IngressValidationOptions{})
|
||||
|
||||
gv := testCase.groupVersion
|
||||
if gv == nil {
|
||||
gv = &networkingv1.SchemeGroupVersion
|
||||
}
|
||||
errs := validateIngressRuleValue(irv, field.NewPath("testing"), IngressValidationOptions{}, *gv)
|
||||
if len(errs) != len(testCase.expectedErrs) {
|
||||
t.Fatalf("Expected %d errors, got %d (%+v)", len(testCase.expectedErrs), len(errs), errs)
|
||||
}
|
||||
@ -1258,9 +1270,14 @@ func TestValidateIngressRuleValue(t *testing.T) {
|
||||
|
||||
func TestValidateIngressCreate(t *testing.T) {
|
||||
implementationPathType := networking.PathTypeImplementationSpecific
|
||||
serviceBackend := &networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
defaultBackend := networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: serviceBackend,
|
||||
}
|
||||
resourceBackend := &api.TypedLocalObjectReference{
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
@ -1274,12 +1291,13 @@ func TestValidateIngressCreate(t *testing.T) {
|
||||
ResourceVersion: "1234",
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &defaultBackend,
|
||||
Rules: []networking.IngressRule{},
|
||||
DefaultBackend: &defaultBackend,
|
||||
Rules: []networking.IngressRule{},
|
||||
},
|
||||
}
|
||||
|
||||
testCases := map[string]struct {
|
||||
groupVersion *schema.GroupVersion
|
||||
tweakIngress func(ingress *networking.Ingress)
|
||||
expectedErrs field.ErrorList
|
||||
}{
|
||||
@ -1319,7 +1337,7 @@ func TestValidateIngressCreate(t *testing.T) {
|
||||
},
|
||||
expectedErrs: field.ErrorList{},
|
||||
},
|
||||
"invalid regex path": {
|
||||
"invalid regex path allowed (v1)": {
|
||||
tweakIngress: func(ingress *networking.Ingress) {
|
||||
ingress.Spec.Rules = []networking.IngressRule{{
|
||||
Host: "foo.bar.com",
|
||||
@ -1338,7 +1356,7 @@ func TestValidateIngressCreate(t *testing.T) {
|
||||
},
|
||||
"Spec.Backend.Resource field allowed on create": {
|
||||
tweakIngress: func(ingress *networking.Ingress) {
|
||||
ingress.Spec.Backend = &networking.IngressBackend{
|
||||
ingress.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Resource: resourceBackend}
|
||||
},
|
||||
expectedErrs: field.ErrorList{},
|
||||
@ -1367,8 +1385,11 @@ func TestValidateIngressCreate(t *testing.T) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
newIngress := baseIngress.DeepCopy()
|
||||
testCase.tweakIngress(newIngress)
|
||||
|
||||
errs := ValidateIngressCreate(newIngress, networkingv1beta1.SchemeGroupVersion)
|
||||
gv := testCase.groupVersion
|
||||
if gv == nil {
|
||||
gv = &networkingv1.SchemeGroupVersion
|
||||
}
|
||||
errs := ValidateIngressCreate(newIngress, *gv)
|
||||
if len(errs) != len(testCase.expectedErrs) {
|
||||
t.Fatalf("Expected %d errors, got %d (%+v)", len(testCase.expectedErrs), len(errs), errs)
|
||||
}
|
||||
@ -1384,9 +1405,14 @@ func TestValidateIngressCreate(t *testing.T) {
|
||||
|
||||
func TestValidateIngressUpdate(t *testing.T) {
|
||||
implementationPathType := networking.PathTypeImplementationSpecific
|
||||
serviceBackend := &networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
defaultBackend := networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: serviceBackend,
|
||||
}
|
||||
resourceBackend := &api.TypedLocalObjectReference{
|
||||
APIGroup: utilpointer.StringPtr("example.com"),
|
||||
@ -1400,7 +1426,7 @@ func TestValidateIngressUpdate(t *testing.T) {
|
||||
ResourceVersion: "1234",
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &defaultBackend,
|
||||
DefaultBackend: &defaultBackend,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1545,26 +1571,26 @@ func TestValidateIngressUpdate(t *testing.T) {
|
||||
},
|
||||
"new Backend.Resource allowed on update": {
|
||||
tweakIngresses: func(newIngress, oldIngress *networking.Ingress) {
|
||||
oldIngress.Spec.Backend = &defaultBackend
|
||||
newIngress.Spec.Backend = &networking.IngressBackend{
|
||||
oldIngress.Spec.DefaultBackend = &defaultBackend
|
||||
newIngress.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Resource: resourceBackend}
|
||||
},
|
||||
expectedErrs: field.ErrorList{},
|
||||
},
|
||||
"old Backend.Resource allowed on update": {
|
||||
"old DefaultBackend.Resource allowed on update": {
|
||||
tweakIngresses: func(newIngress, oldIngress *networking.Ingress) {
|
||||
oldIngress.Spec.Backend = &networking.IngressBackend{
|
||||
oldIngress.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Resource: resourceBackend}
|
||||
newIngress.Spec.Backend = &networking.IngressBackend{
|
||||
newIngress.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Resource: resourceBackend}
|
||||
},
|
||||
expectedErrs: field.ErrorList{},
|
||||
},
|
||||
"changing spec.backend from resource -> no resource": {
|
||||
tweakIngresses: func(newIngress, oldIngress *networking.Ingress) {
|
||||
oldIngress.Spec.Backend = &networking.IngressBackend{
|
||||
oldIngress.Spec.DefaultBackend = &networking.IngressBackend{
|
||||
Resource: resourceBackend}
|
||||
newIngress.Spec.Backend = &defaultBackend
|
||||
newIngress.Spec.DefaultBackend = &defaultBackend
|
||||
},
|
||||
expectedErrs: field.ErrorList{},
|
||||
},
|
||||
@ -1899,11 +1925,15 @@ func TestValidateIngressClassUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateIngressTLS(t *testing.T) {
|
||||
defaultBackend := networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
serviceBackend := &networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
defaultBackend := networking.IngressBackend{
|
||||
Service: serviceBackend,
|
||||
}
|
||||
|
||||
newValid := func() networking.Ingress {
|
||||
return networking.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -1911,10 +1941,7 @@ func TestValidateIngressTLS(t *testing.T) {
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
},
|
||||
DefaultBackend: &defaultBackend,
|
||||
Rules: []networking.IngressRule{
|
||||
{
|
||||
Host: "foo.bar.com",
|
||||
@ -1987,9 +2014,14 @@ func TestValidateIngressTLS(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateIngressStatusUpdate(t *testing.T) {
|
||||
serviceBackend := &networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
defaultBackend := networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: serviceBackend,
|
||||
}
|
||||
|
||||
newValid := func() networking.Ingress {
|
||||
@ -2000,10 +2032,7 @@ func TestValidateIngressStatusUpdate(t *testing.T) {
|
||||
ResourceVersion: "9",
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
},
|
||||
DefaultBackend: &defaultBackend,
|
||||
Rules: []networking.IngressRule{
|
||||
{
|
||||
Host: "foo.bar.com",
|
||||
|
43
pkg/apis/networking/zz_generated.deepcopy.go
generated
43
pkg/apis/networking/zz_generated.deepcopy.go
generated
@ -124,7 +124,11 @@ func (in *Ingress) DeepCopyObject() runtime.Object {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressBackend) DeepCopyInto(out *IngressBackend) {
|
||||
*out = *in
|
||||
out.ServicePort = in.ServicePort
|
||||
if in.Service != nil {
|
||||
in, out := &in.Service, &out.Service
|
||||
*out = new(IngressServiceBackend)
|
||||
**out = **in
|
||||
}
|
||||
if in.Resource != nil {
|
||||
in, out := &in.Resource, &out.Resource
|
||||
*out = new(core.TypedLocalObjectReference)
|
||||
@ -295,6 +299,23 @@ func (in *IngressRuleValue) DeepCopy() *IngressRuleValue {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressServiceBackend) DeepCopyInto(out *IngressServiceBackend) {
|
||||
*out = *in
|
||||
out.Port = in.Port
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressServiceBackend.
|
||||
func (in *IngressServiceBackend) DeepCopy() *IngressServiceBackend {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressServiceBackend)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressSpec) DeepCopyInto(out *IngressSpec) {
|
||||
*out = *in
|
||||
@ -303,8 +324,8 @@ func (in *IngressSpec) DeepCopyInto(out *IngressSpec) {
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Backend != nil {
|
||||
in, out := &in.Backend, &out.Backend
|
||||
if in.DefaultBackend != nil {
|
||||
in, out := &in.DefaultBackend, &out.DefaultBackend
|
||||
*out = new(IngressBackend)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
@ -585,3 +606,19 @@ func (in *NetworkPolicySpec) DeepCopy() *NetworkPolicySpec {
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBackendPort) DeepCopyInto(out *ServiceBackendPort) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBackendPort.
|
||||
func (in *ServiceBackendPort) DeepCopy() *ServiceBackendPort {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceBackendPort)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ var GVRToStorageVersionHash = map[string]string{
|
||||
"networking.k8s.io/v1/networkpolicies": "YpfwF18m1G8=",
|
||||
"networking.k8s.io/v1beta1/ingresses": "ZOAfGflaKd0=",
|
||||
"networking.k8s.io/v1beta1/ingressclasses": "l/iqIbDgFyQ=",
|
||||
"networking.k8s.io/v1/ingresses": "ZOAfGflaKd0=",
|
||||
"networking.k8s.io/v1/ingressclasses": "l/iqIbDgFyQ=",
|
||||
"node.k8s.io/v1beta1/runtimeclasses": "8nMHWqj34s0=",
|
||||
"policy/v1beta1/poddisruptionbudgets": "6BGBu0kpHtk=",
|
||||
"policy/v1beta1/podsecuritypolicies": "khBLobUXkqA=",
|
||||
|
@ -893,9 +893,14 @@ func TestPrintIngress(t *testing.T) {
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
IngressClassName: utilpointer.StringPtr("foo"),
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: "svc",
|
||||
ServicePort: intstr.FromInt(93),
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: "default-backend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "default-backend",
|
||||
Number: 80,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Status: networking.IngressStatus{
|
||||
|
@ -34,7 +34,6 @@ go_test(
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@ -62,6 +62,13 @@ var (
|
||||
defaultTLS = []networking.IngressTLS{
|
||||
{Hosts: []string{"foo.bar.com", "*.bar.com"}, SecretName: "fooSecret"},
|
||||
}
|
||||
serviceBackend = &networking.IngressServiceBackend{
|
||||
Name: "defaultbackend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "",
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
type IngressRuleValues map[string]string
|
||||
@ -73,8 +80,13 @@ func toHTTPIngressPaths(pathMap map[string]string) []networking.HTTPIngressPath
|
||||
Path: path,
|
||||
PathType: &defaultPathType,
|
||||
Backend: networking.IngressBackend{
|
||||
ServiceName: backend,
|
||||
ServicePort: defaultBackendPort,
|
||||
Service: &networking.IngressServiceBackend{
|
||||
Name: backend,
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: defaultBackendPort.StrVal,
|
||||
Number: defaultBackendPort.IntVal,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -103,9 +115,8 @@ func newIngress(pathMap map[string]string) *networking.Ingress {
|
||||
Namespace: namespace,
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: defaultBackendName,
|
||||
ServicePort: defaultBackendPort,
|
||||
DefaultBackend: &networking.IngressBackend{
|
||||
Service: serviceBackend.DeepCopy(),
|
||||
},
|
||||
Rules: toIngressRules(map[string]IngressRuleValues{
|
||||
defaultHostname: pathMap,
|
||||
@ -132,16 +143,16 @@ func TestCreate(t *testing.T) {
|
||||
defer storage.Store.DestroyFunc()
|
||||
test := genericregistrytest.New(t, storage.Store)
|
||||
ingress := validIngress()
|
||||
noBackendAndRules := validIngress()
|
||||
noBackendAndRules.Spec.Backend = &networking.IngressBackend{}
|
||||
noBackendAndRules.Spec.Rules = []networking.IngressRule{}
|
||||
noDefaultBackendAndRules := validIngress()
|
||||
noDefaultBackendAndRules.Spec.DefaultBackend.Service = &networking.IngressServiceBackend{}
|
||||
noDefaultBackendAndRules.Spec.Rules = []networking.IngressRule{}
|
||||
badPath := validIngress()
|
||||
badPath.Spec.Rules = toIngressRules(map[string]IngressRuleValues{
|
||||
"foo.bar.com": {"invalid-no-leading-slash": "svc"}})
|
||||
test.TestCreate(
|
||||
// valid
|
||||
ingress,
|
||||
noBackendAndRules,
|
||||
noDefaultBackendAndRules,
|
||||
badPath,
|
||||
)
|
||||
}
|
||||
|
@ -20,16 +20,21 @@ import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
func newIngress() networking.Ingress {
|
||||
serviceBackend := &networking.IngressServiceBackend{
|
||||
Name: "default-backend",
|
||||
Port: networking.ServiceBackendPort{
|
||||
Name: "",
|
||||
Number: 80,
|
||||
},
|
||||
}
|
||||
defaultBackend := networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
Service: serviceBackend.DeepCopy(),
|
||||
}
|
||||
implementationPathType := networking.PathTypeImplementationSpecific
|
||||
return networking.Ingress{
|
||||
@ -38,10 +43,7 @@ func newIngress() networking.Ingress {
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: networking.IngressSpec{
|
||||
Backend: &networking.IngressBackend{
|
||||
ServiceName: "default-backend",
|
||||
ServicePort: intstr.FromInt(80),
|
||||
},
|
||||
DefaultBackend: defaultBackend.DeepCopy(),
|
||||
Rules: []networking.IngressRule{
|
||||
{
|
||||
Host: "foo.bar.com",
|
||||
@ -51,7 +53,7 @@ func newIngress() networking.Ingress {
|
||||
{
|
||||
Path: "/foo",
|
||||
PathType: &implementationPathType,
|
||||
Backend: defaultBackend,
|
||||
Backend: *defaultBackend.DeepCopy(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -72,7 +74,7 @@ func newIngress() networking.Ingress {
|
||||
func TestIngressStrategy(t *testing.T) {
|
||||
ctx := genericapirequest.NewDefaultContext()
|
||||
apiRequest := genericapirequest.RequestInfo{APIGroup: "networking.k8s.io",
|
||||
APIVersion: "v1beta1",
|
||||
APIVersion: "v1",
|
||||
Resource: "ingresses",
|
||||
}
|
||||
ctx = genericapirequest.WithRequestInfo(ctx, &apiRequest)
|
||||
@ -117,7 +119,7 @@ func TestIngressStatusStrategy(t *testing.T) {
|
||||
newIngress := newIngress()
|
||||
oldIngress.ResourceVersion = "4"
|
||||
newIngress.ResourceVersion = "4"
|
||||
newIngress.Spec.Backend.ServiceName = "ignore"
|
||||
newIngress.Spec.DefaultBackend.Service.Name = "ignore"
|
||||
newIngress.Status = networking.IngressStatus{
|
||||
LoadBalancer: api.LoadBalancerStatus{
|
||||
Ingress: []api.LoadBalancerIngress{
|
||||
@ -129,7 +131,7 @@ func TestIngressStatusStrategy(t *testing.T) {
|
||||
if newIngress.Status.LoadBalancer.Ingress[0].IP != "127.0.0.2" {
|
||||
t.Errorf("Ingress status updates should allow change of status fields")
|
||||
}
|
||||
if newIngress.Spec.Backend.ServiceName != "default-backend" {
|
||||
if newIngress.Spec.DefaultBackend.Service.Name != "default-backend" {
|
||||
t.Errorf("PrepareForUpdate should have preserved old spec")
|
||||
}
|
||||
errs := StatusStrategy.ValidateUpdate(ctx, &newIngress, &oldIngress)
|
||||
|
@ -65,6 +65,21 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
||||
}
|
||||
storage["networkpolicies"] = networkPolicyStorage
|
||||
|
||||
// ingresses
|
||||
ingressStorage, ingressStatusStorage, err := ingressstore.NewREST(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage["ingresses"] = ingressStorage
|
||||
storage["ingresses/status"] = ingressStatusStorage
|
||||
|
||||
// ingressclasses
|
||||
ingressClassStorage, err := ingressclassstore.NewREST(restOptionsGetter)
|
||||
if err != nil {
|
||||
return storage, err
|
||||
}
|
||||
storage["ingressclasses"] = ingressClassStorage
|
||||
|
||||
return storage, nil
|
||||
}
|
||||
|
||||
|
3480
staging/src/k8s.io/api/networking/v1/generated.pb.go
generated
3480
staging/src/k8s.io/api/networking/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,48 @@ import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
|
||||
// Package-wide variables from generator "generated".
|
||||
option go_package = "v1";
|
||||
|
||||
// HTTPIngressPath associates a path with a backend. Incoming urls matching the
|
||||
// path are forwarded to the backend.
|
||||
message HTTPIngressPath {
|
||||
// Path is matched against the path of an incoming request. Currently it can
|
||||
// contain characters disallowed from the conventional "path" part of a URL
|
||||
// as defined by RFC 3986. Paths must begin with a '/'. When unspecified,
|
||||
// all paths from incoming requests are matched.
|
||||
// +optional
|
||||
optional string path = 1;
|
||||
|
||||
// PathType determines the interpretation of the Path matching. PathType can
|
||||
// be one of the following values:
|
||||
// * Exact: Matches the URL path exactly.
|
||||
// * Prefix: Matches based on a URL path prefix split by '/'. Matching is
|
||||
// done on a path element by element basis. A path element refers is the
|
||||
// list of labels in the path split by the '/' separator. A request is a
|
||||
// match for path p if every p is an element-wise prefix of p of the
|
||||
// request path. Note that if the last element of the path is a substring
|
||||
// of the last element in request path, it is not a match (e.g. /foo/bar
|
||||
// matches /foo/bar/baz, but does not match /foo/barbaz).
|
||||
// * ImplementationSpecific: Interpretation of the Path matching is up to
|
||||
// the IngressClass. Implementations can treat this as a separate PathType
|
||||
// or treat it identically to Prefix or Exact path types.
|
||||
// Implementations are required to support all path types.
|
||||
optional string pathType = 3;
|
||||
|
||||
// Backend defines the referenced service endpoint to which the traffic
|
||||
// will be forwarded to.
|
||||
optional IngressBackend backend = 2;
|
||||
}
|
||||
|
||||
// HTTPIngressRuleValue is a list of http selectors pointing to backends.
|
||||
// In the example: http://<host>/<path>?<searchpart> -> backend where
|
||||
// where parts of the url correspond to RFC 3986, this resource will be used
|
||||
// to match against everything after the last '/' and before the first '?'
|
||||
// or '#'.
|
||||
message HTTPIngressRuleValue {
|
||||
// A collection of paths that map requests to backends.
|
||||
// +listType=atomic
|
||||
repeated HTTPIngressPath paths = 1;
|
||||
}
|
||||
|
||||
// IPBlock describes a particular CIDR (Ex. "192.168.1.1/24","2001:db9::/64") that is allowed
|
||||
// to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs
|
||||
// that should not be included within this rule.
|
||||
@ -45,6 +87,219 @@ message IPBlock {
|
||||
repeated string except = 2;
|
||||
}
|
||||
|
||||
// Ingress is a collection of rules that allow inbound connections to reach the
|
||||
// endpoints defined by a backend. An Ingress can be configured to give services
|
||||
// externally-reachable urls, load balance traffic, terminate SSL, offer name
|
||||
// based virtual hosting etc.
|
||||
message Ingress {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec is the desired state of the Ingress.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
optional IngressSpec spec = 2;
|
||||
|
||||
// Status is the current state of the Ingress.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
optional IngressStatus status = 3;
|
||||
}
|
||||
|
||||
// IngressBackend describes all endpoints for a given service and port.
|
||||
message IngressBackend {
|
||||
// Service references a Service as a Backend.
|
||||
// This is a mutually exclusive setting with "Resource".
|
||||
// +optional
|
||||
optional IngressServiceBackend service = 4;
|
||||
|
||||
// Resource is an ObjectRef to another Kubernetes resource in the namespace
|
||||
// of the Ingress object. If resource is specified, a service.Name and
|
||||
// service.Port must not be specified.
|
||||
// This is a mutually exclusive setting with "Service".
|
||||
// +optional
|
||||
optional k8s.io.api.core.v1.TypedLocalObjectReference resource = 3;
|
||||
}
|
||||
|
||||
// IngressClass represents the class of the Ingress, referenced by the Ingress
|
||||
// Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be
|
||||
// used to indicate that an IngressClass should be considered default. When a
|
||||
// single IngressClass resource has this annotation set to true, new Ingress
|
||||
// resources without a class specified will be assigned this default class.
|
||||
message IngressClass {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec is the desired state of the IngressClass.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
optional IngressClassSpec spec = 2;
|
||||
}
|
||||
|
||||
// IngressClassList is a collection of IngressClasses.
|
||||
message IngressClassList {
|
||||
// Standard list metadata.
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// Items is the list of IngressClasses.
|
||||
repeated IngressClass items = 2;
|
||||
}
|
||||
|
||||
// IngressClassSpec provides information about the class of an Ingress.
|
||||
message IngressClassSpec {
|
||||
// Controller refers to the name of the controller that should handle this
|
||||
// class. This allows for different "flavors" that are controlled by the
|
||||
// same controller. For example, you may have different Parameters for the
|
||||
// same implementing controller. This should be specified as a
|
||||
// domain-prefixed path no more than 250 characters in length, e.g.
|
||||
// "acme.io/ingress-controller". This field is immutable.
|
||||
optional string controller = 1;
|
||||
|
||||
// Parameters is a link to a custom resource containing additional
|
||||
// configuration for the controller. This is optional if the controller does
|
||||
// not require extra parameters.
|
||||
// +optional
|
||||
optional k8s.io.api.core.v1.TypedLocalObjectReference parameters = 2;
|
||||
}
|
||||
|
||||
// IngressList is a collection of Ingress.
|
||||
message IngressList {
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// Items is the list of Ingress.
|
||||
repeated Ingress items = 2;
|
||||
}
|
||||
|
||||
// IngressRule represents the rules mapping the paths under a specified host to
|
||||
// the related backend services. Incoming requests are first evaluated for a host
|
||||
// match, then routed to the backend associated with the matching IngressRuleValue.
|
||||
message IngressRule {
|
||||
// Host is the fully qualified domain name of a network host, as defined by RFC 3986.
|
||||
// Note the following deviations from the "host" part of the
|
||||
// URI as defined in RFC 3986:
|
||||
// 1. IPs are not allowed. Currently an IngressRuleValue can only apply to
|
||||
// the IP in the Spec of the parent Ingress.
|
||||
// 2. The `:` delimiter is not respected because ports are not allowed.
|
||||
// Currently the port of an Ingress is implicitly :80 for http and
|
||||
// :443 for https.
|
||||
// Both these may change in the future.
|
||||
// Incoming requests are matched against the host before the
|
||||
// IngressRuleValue. If the host is unspecified, the Ingress routes all
|
||||
// traffic based on the specified IngressRuleValue.
|
||||
//
|
||||
// Host can be "precise" which is a domain name without the terminating dot of
|
||||
// a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name
|
||||
// prefixed with a single wildcard label (e.g. "*.foo.com").
|
||||
// The wildcard character '*' must appear by itself as the first DNS label and
|
||||
// matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*").
|
||||
// Requests will be matched against the Host field in the following way:
|
||||
// 1. If Host is precise, the request matches this rule if the http host header is equal to Host.
|
||||
// 2. If Host is a wildcard, then the request matches this rule if the http host header
|
||||
// is to equal to the suffix (removing the first label) of the wildcard rule.
|
||||
// +optional
|
||||
optional string host = 1;
|
||||
|
||||
// IngressRuleValue represents a rule to route requests for this IngressRule.
|
||||
// If unspecified, the rule defaults to a http catch-all. Whether that sends
|
||||
// just traffic matching the host to the default backend or all traffic to the
|
||||
// default backend, is left to the controller fulfilling the Ingress. Http is
|
||||
// currently the only supported IngressRuleValue.
|
||||
// +optional
|
||||
optional IngressRuleValue ingressRuleValue = 2;
|
||||
}
|
||||
|
||||
// IngressRuleValue represents a rule to apply against incoming requests. If the
|
||||
// rule is satisfied, the request is routed to the specified backend. Currently
|
||||
// mixing different types of rules in a single Ingress is disallowed, so exactly
|
||||
// one of the following must be set.
|
||||
message IngressRuleValue {
|
||||
// +optional
|
||||
optional HTTPIngressRuleValue http = 1;
|
||||
}
|
||||
|
||||
// IngressServiceBackend references a Kubernetes Service as a Backend.
|
||||
message IngressServiceBackend {
|
||||
// Name is the referenced service. The service must exist in
|
||||
// the same namespace as the Ingress object.
|
||||
optional string name = 1;
|
||||
|
||||
// Port of the referenced service. A port name or port number
|
||||
// is required for a IngressServiceBackend.
|
||||
optional ServiceBackendPort port = 2;
|
||||
}
|
||||
|
||||
// IngressSpec describes the Ingress the user wishes to exist.
|
||||
message IngressSpec {
|
||||
// IngressClassName is the name of the IngressClass cluster resource. The
|
||||
// associated IngressClass defines which controller will implement the
|
||||
// resource. This replaces the deprecated `kubernetes.io/ingress.class`
|
||||
// annotation. For backwards compatibility, when that annotation is set, it
|
||||
// must be given precedence over this field. The controller may emit a
|
||||
// warning if the field and annotation have different values.
|
||||
// Implementations of this API should ignore Ingresses without a class
|
||||
// specified. An IngressClass resource may be marked as default, which can
|
||||
// be used to set a default value for this field. For more information,
|
||||
// refer to the IngressClass documentation.
|
||||
// +optional
|
||||
optional string ingressClassName = 4;
|
||||
|
||||
// DefaultBackend is the backend that should handle requests that don't
|
||||
// match any rule. If Rules are not specified, DefaultBackend must be specified.
|
||||
// If DefaultBackend is not set, the handling of requests that do not match any
|
||||
// of the rules will be up to the Ingress controller.
|
||||
// +optional
|
||||
optional IngressBackend defaultBackend = 1;
|
||||
|
||||
// TLS configuration. Currently the Ingress only supports a single TLS
|
||||
// port, 443. If multiple members of this list specify different hosts, they
|
||||
// will be multiplexed on the same port according to the hostname specified
|
||||
// through the SNI TLS extension, if the ingress controller fulfilling the
|
||||
// ingress supports SNI.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
repeated IngressTLS tls = 2;
|
||||
|
||||
// A list of host rules used to configure the Ingress. If unspecified, or
|
||||
// no rule matches, all traffic is sent to the default backend.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
repeated IngressRule rules = 3;
|
||||
}
|
||||
|
||||
// IngressStatus describe the current state of the Ingress.
|
||||
message IngressStatus {
|
||||
// LoadBalancer contains the current status of the load-balancer.
|
||||
// +optional
|
||||
optional k8s.io.api.core.v1.LoadBalancerStatus loadBalancer = 1;
|
||||
}
|
||||
|
||||
// IngressTLS describes the transport layer security associated with an Ingress.
|
||||
message IngressTLS {
|
||||
// Hosts are a list of hosts included in the TLS certificate. The values in
|
||||
// this list must match the name/s used in the tlsSecret. Defaults to the
|
||||
// wildcard host setting for the loadbalancer controller fulfilling this
|
||||
// Ingress, if left unspecified.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
repeated string hosts = 1;
|
||||
|
||||
// SecretName is the name of the secret used to terminate TLS traffic on
|
||||
// port 443. Field is left optional to allow TLS routing based on SNI
|
||||
// hostname alone. If the SNI host in a listener conflicts with the "Host"
|
||||
// header field used by an IngressRule, the SNI host is used for termination
|
||||
// and value of the Host header is used for routing.
|
||||
// +optional
|
||||
optional string secretName = 2;
|
||||
}
|
||||
|
||||
// NetworkPolicy describes what network traffic is allowed for a set of Pods
|
||||
message NetworkPolicy {
|
||||
// Standard object's metadata.
|
||||
@ -193,3 +448,16 @@ message NetworkPolicySpec {
|
||||
repeated string policyTypes = 4;
|
||||
}
|
||||
|
||||
// ServiceBackendPort is the service port being referenced.
|
||||
message ServiceBackendPort {
|
||||
// Name is the name of the port on the Service.
|
||||
// This is a mutually exclusive setting with "Number".
|
||||
// +optional
|
||||
optional string name = 1;
|
||||
|
||||
// Number is the numerical port number (e.g. 80) on the Service.
|
||||
// This is a mutually exclusive setting with "Name".
|
||||
// +optional
|
||||
optional int32 number = 2;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,10 @@ var (
|
||||
// Adds the list of known types to the given scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&Ingress{},
|
||||
&IngressList{},
|
||||
&IngressClass{},
|
||||
&IngressClassList{},
|
||||
&NetworkPolicy{},
|
||||
&NetworkPolicyList{},
|
||||
)
|
||||
|
@ -201,3 +201,314 @@ type NetworkPolicyList struct {
|
||||
// Items is a list of schema objects.
|
||||
Items []NetworkPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Ingress is a collection of rules that allow inbound connections to reach the
|
||||
// endpoints defined by a backend. An Ingress can be configured to give services
|
||||
// externally-reachable urls, load balance traffic, terminate SSL, offer name
|
||||
// based virtual hosting etc.
|
||||
type Ingress struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec is the desired state of the Ingress.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec IngressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
||||
// Status is the current state of the Ingress.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Status IngressStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// IngressList is a collection of Ingress.
|
||||
type IngressList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of Ingress.
|
||||
Items []Ingress `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// IngressSpec describes the Ingress the user wishes to exist.
|
||||
type IngressSpec struct {
|
||||
// IngressClassName is the name of the IngressClass cluster resource. The
|
||||
// associated IngressClass defines which controller will implement the
|
||||
// resource. This replaces the deprecated `kubernetes.io/ingress.class`
|
||||
// annotation. For backwards compatibility, when that annotation is set, it
|
||||
// must be given precedence over this field. The controller may emit a
|
||||
// warning if the field and annotation have different values.
|
||||
// Implementations of this API should ignore Ingresses without a class
|
||||
// specified. An IngressClass resource may be marked as default, which can
|
||||
// be used to set a default value for this field. For more information,
|
||||
// refer to the IngressClass documentation.
|
||||
// +optional
|
||||
IngressClassName *string `json:"ingressClassName,omitempty" protobuf:"bytes,4,opt,name=ingressClassName"`
|
||||
|
||||
// DefaultBackend is the backend that should handle requests that don't
|
||||
// match any rule. If Rules are not specified, DefaultBackend must be specified.
|
||||
// If DefaultBackend is not set, the handling of requests that do not match any
|
||||
// of the rules will be up to the Ingress controller.
|
||||
// +optional
|
||||
DefaultBackend *IngressBackend `json:"defaultBackend,omitempty" protobuf:"bytes,1,opt,name=defaultBackend"`
|
||||
|
||||
// TLS configuration. Currently the Ingress only supports a single TLS
|
||||
// port, 443. If multiple members of this list specify different hosts, they
|
||||
// will be multiplexed on the same port according to the hostname specified
|
||||
// through the SNI TLS extension, if the ingress controller fulfilling the
|
||||
// ingress supports SNI.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
TLS []IngressTLS `json:"tls,omitempty" protobuf:"bytes,2,rep,name=tls"`
|
||||
|
||||
// A list of host rules used to configure the Ingress. If unspecified, or
|
||||
// no rule matches, all traffic is sent to the default backend.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
Rules []IngressRule `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"`
|
||||
}
|
||||
|
||||
// IngressTLS describes the transport layer security associated with an Ingress.
|
||||
type IngressTLS struct {
|
||||
// Hosts are a list of hosts included in the TLS certificate. The values in
|
||||
// this list must match the name/s used in the tlsSecret. Defaults to the
|
||||
// wildcard host setting for the loadbalancer controller fulfilling this
|
||||
// Ingress, if left unspecified.
|
||||
// +listType=atomic
|
||||
// +optional
|
||||
Hosts []string `json:"hosts,omitempty" protobuf:"bytes,1,rep,name=hosts"`
|
||||
// SecretName is the name of the secret used to terminate TLS traffic on
|
||||
// port 443. Field is left optional to allow TLS routing based on SNI
|
||||
// hostname alone. If the SNI host in a listener conflicts with the "Host"
|
||||
// header field used by an IngressRule, the SNI host is used for termination
|
||||
// and value of the Host header is used for routing.
|
||||
// +optional
|
||||
SecretName string `json:"secretName,omitempty" protobuf:"bytes,2,opt,name=secretName"`
|
||||
}
|
||||
|
||||
// IngressStatus describe the current state of the Ingress.
|
||||
type IngressStatus struct {
|
||||
// LoadBalancer contains the current status of the load-balancer.
|
||||
// +optional
|
||||
LoadBalancer v1.LoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"`
|
||||
}
|
||||
|
||||
// IngressRule represents the rules mapping the paths under a specified host to
|
||||
// the related backend services. Incoming requests are first evaluated for a host
|
||||
// match, then routed to the backend associated with the matching IngressRuleValue.
|
||||
type IngressRule struct {
|
||||
// Host is the fully qualified domain name of a network host, as defined by RFC 3986.
|
||||
// Note the following deviations from the "host" part of the
|
||||
// URI as defined in RFC 3986:
|
||||
// 1. IPs are not allowed. Currently an IngressRuleValue can only apply to
|
||||
// the IP in the Spec of the parent Ingress.
|
||||
// 2. The `:` delimiter is not respected because ports are not allowed.
|
||||
// Currently the port of an Ingress is implicitly :80 for http and
|
||||
// :443 for https.
|
||||
// Both these may change in the future.
|
||||
// Incoming requests are matched against the host before the
|
||||
// IngressRuleValue. If the host is unspecified, the Ingress routes all
|
||||
// traffic based on the specified IngressRuleValue.
|
||||
//
|
||||
// Host can be "precise" which is a domain name without the terminating dot of
|
||||
// a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name
|
||||
// prefixed with a single wildcard label (e.g. "*.foo.com").
|
||||
// The wildcard character '*' must appear by itself as the first DNS label and
|
||||
// matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*").
|
||||
// Requests will be matched against the Host field in the following way:
|
||||
// 1. If Host is precise, the request matches this rule if the http host header is equal to Host.
|
||||
// 2. If Host is a wildcard, then the request matches this rule if the http host header
|
||||
// is to equal to the suffix (removing the first label) of the wildcard rule.
|
||||
// +optional
|
||||
Host string `json:"host,omitempty" protobuf:"bytes,1,opt,name=host"`
|
||||
// IngressRuleValue represents a rule to route requests for this IngressRule.
|
||||
// If unspecified, the rule defaults to a http catch-all. Whether that sends
|
||||
// just traffic matching the host to the default backend or all traffic to the
|
||||
// default backend, is left to the controller fulfilling the Ingress. Http is
|
||||
// currently the only supported IngressRuleValue.
|
||||
// +optional
|
||||
IngressRuleValue `json:",inline,omitempty" protobuf:"bytes,2,opt,name=ingressRuleValue"`
|
||||
}
|
||||
|
||||
// IngressRuleValue represents a rule to apply against incoming requests. If the
|
||||
// rule is satisfied, the request is routed to the specified backend. Currently
|
||||
// mixing different types of rules in a single Ingress is disallowed, so exactly
|
||||
// one of the following must be set.
|
||||
type IngressRuleValue struct {
|
||||
// +optional
|
||||
HTTP *HTTPIngressRuleValue `json:"http,omitempty" protobuf:"bytes,1,opt,name=http"`
|
||||
}
|
||||
|
||||
// HTTPIngressRuleValue is a list of http selectors pointing to backends.
|
||||
// In the example: http://<host>/<path>?<searchpart> -> backend where
|
||||
// where parts of the url correspond to RFC 3986, this resource will be used
|
||||
// to match against everything after the last '/' and before the first '?'
|
||||
// or '#'.
|
||||
type HTTPIngressRuleValue struct {
|
||||
// A collection of paths that map requests to backends.
|
||||
// +listType=atomic
|
||||
Paths []HTTPIngressPath `json:"paths" protobuf:"bytes,1,rep,name=paths"`
|
||||
}
|
||||
|
||||
// PathType represents the type of path referred to by a HTTPIngressPath.
|
||||
type PathType string
|
||||
|
||||
const (
|
||||
// PathTypeExact matches the URL path exactly and with case sensitivity.
|
||||
PathTypeExact = PathType("Exact")
|
||||
|
||||
// PathTypePrefix matches based on a URL path prefix split by '/'. Matching
|
||||
// is case sensitive and done on a path element by element basis. A path
|
||||
// element refers to the list of labels in the path split by the '/'
|
||||
// separator. A request is a match for path p if every p is an element-wise
|
||||
// prefix of p of the request path. Note that if the last element of the
|
||||
// path is a substring of the last element in request path, it is not a
|
||||
// match (e.g. /foo/bar matches /foo/bar/baz, but does not match
|
||||
// /foo/barbaz). If multiple matching paths exist in an Ingress spec, the
|
||||
// longest matching path is given priority.
|
||||
// Examples:
|
||||
// - /foo/bar does not match requests to /foo/barbaz
|
||||
// - /foo/bar matches request to /foo/bar and /foo/bar/baz
|
||||
// - /foo and /foo/ both match requests to /foo and /foo/. If both paths are
|
||||
// present in an Ingress spec, the longest matching path (/foo/) is given
|
||||
// priority.
|
||||
PathTypePrefix = PathType("Prefix")
|
||||
|
||||
// PathTypeImplementationSpecific matching is up to the IngressClass.
|
||||
// Implementations can treat this as a separate PathType or treat it
|
||||
// identically to Prefix or Exact path types.
|
||||
PathTypeImplementationSpecific = PathType("ImplementationSpecific")
|
||||
)
|
||||
|
||||
// HTTPIngressPath associates a path with a backend. Incoming urls matching the
|
||||
// path are forwarded to the backend.
|
||||
type HTTPIngressPath struct {
|
||||
// Path is matched against the path of an incoming request. Currently it can
|
||||
// contain characters disallowed from the conventional "path" part of a URL
|
||||
// as defined by RFC 3986. Paths must begin with a '/'. When unspecified,
|
||||
// all paths from incoming requests are matched.
|
||||
// +optional
|
||||
Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"`
|
||||
|
||||
// PathType determines the interpretation of the Path matching. PathType can
|
||||
// be one of the following values:
|
||||
// * Exact: Matches the URL path exactly.
|
||||
// * Prefix: Matches based on a URL path prefix split by '/'. Matching is
|
||||
// done on a path element by element basis. A path element refers is the
|
||||
// list of labels in the path split by the '/' separator. A request is a
|
||||
// match for path p if every p is an element-wise prefix of p of the
|
||||
// request path. Note that if the last element of the path is a substring
|
||||
// of the last element in request path, it is not a match (e.g. /foo/bar
|
||||
// matches /foo/bar/baz, but does not match /foo/barbaz).
|
||||
// * ImplementationSpecific: Interpretation of the Path matching is up to
|
||||
// the IngressClass. Implementations can treat this as a separate PathType
|
||||
// or treat it identically to Prefix or Exact path types.
|
||||
// Implementations are required to support all path types.
|
||||
PathType *PathType `json:"pathType,omitempty" protobuf:"bytes,3,opt,name=pathType"`
|
||||
|
||||
// Backend defines the referenced service endpoint to which the traffic
|
||||
// will be forwarded to.
|
||||
Backend IngressBackend `json:"backend" protobuf:"bytes,2,opt,name=backend"`
|
||||
}
|
||||
|
||||
// IngressBackend describes all endpoints for a given service and port.
|
||||
type IngressBackend struct {
|
||||
// Service references a Service as a Backend.
|
||||
// This is a mutually exclusive setting with "Resource".
|
||||
// +optional
|
||||
Service *IngressServiceBackend `json:"service,omitempty" protobuf:"bytes,4,opt,name=service"`
|
||||
|
||||
// Resource is an ObjectRef to another Kubernetes resource in the namespace
|
||||
// of the Ingress object. If resource is specified, a service.Name and
|
||||
// service.Port must not be specified.
|
||||
// This is a mutually exclusive setting with "Service".
|
||||
// +optional
|
||||
Resource *v1.TypedLocalObjectReference `json:"resource,omitempty" protobuf:"bytes,3,opt,name=resource"`
|
||||
}
|
||||
|
||||
// IngressServiceBackend references a Kubernetes Service as a Backend.
|
||||
type IngressServiceBackend struct {
|
||||
// Name is the referenced service. The service must exist in
|
||||
// the same namespace as the Ingress object.
|
||||
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
|
||||
|
||||
// Port of the referenced service. A port name or port number
|
||||
// is required for a IngressServiceBackend.
|
||||
Port ServiceBackendPort `json:"port,omitempty" protobuf:"bytes,2,opt,name=port"`
|
||||
}
|
||||
|
||||
// ServiceBackendPort is the service port being referenced.
|
||||
type ServiceBackendPort struct {
|
||||
// Name is the name of the port on the Service.
|
||||
// This is a mutually exclusive setting with "Number".
|
||||
// +optional
|
||||
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
|
||||
|
||||
// Number is the numerical port number (e.g. 80) on the Service.
|
||||
// This is a mutually exclusive setting with "Name".
|
||||
// +optional
|
||||
Number int32 `json:"number,omitempty" protobuf:"bytes,2,opt,name=number"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// IngressClass represents the class of the Ingress, referenced by the Ingress
|
||||
// Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be
|
||||
// used to indicate that an IngressClass should be considered default. When a
|
||||
// single IngressClass resource has this annotation set to true, new Ingress
|
||||
// resources without a class specified will be assigned this default class.
|
||||
type IngressClass struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec is the desired state of the IngressClass.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||
// +optional
|
||||
Spec IngressClassSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
}
|
||||
|
||||
// IngressClassSpec provides information about the class of an Ingress.
|
||||
type IngressClassSpec struct {
|
||||
// Controller refers to the name of the controller that should handle this
|
||||
// class. This allows for different "flavors" that are controlled by the
|
||||
// same controller. For example, you may have different Parameters for the
|
||||
// same implementing controller. This should be specified as a
|
||||
// domain-prefixed path no more than 250 characters in length, e.g.
|
||||
// "acme.io/ingress-controller". This field is immutable.
|
||||
Controller string `json:"controller,omitempty" protobuf:"bytes,1,opt,name=controller"`
|
||||
|
||||
// Parameters is a link to a custom resource containing additional
|
||||
// configuration for the controller. This is optional if the controller does
|
||||
// not require extra parameters.
|
||||
// +optional
|
||||
Parameters *v1.TypedLocalObjectReference `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// IngressClassList is a collection of IngressClasses.
|
||||
type IngressClassList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of IngressClasses.
|
||||
Items []IngressClass `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
@ -27,6 +27,26 @@ package v1
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
|
||||
var map_HTTPIngressPath = map[string]string{
|
||||
"": "HTTPIngressPath associates a path with a backend. Incoming urls matching the path are forwarded to the backend.",
|
||||
"path": "Path is matched against the path of an incoming request. Currently it can contain characters disallowed from the conventional \"path\" part of a URL as defined by RFC 3986. Paths must begin with a '/'. When unspecified, all paths from incoming requests are matched.",
|
||||
"pathType": "PathType determines the interpretation of the Path matching. PathType can be one of the following values: * Exact: Matches the URL path exactly. * Prefix: Matches based on a URL path prefix split by '/'. Matching is\n done on a path element by element basis. A path element refers is the\n list of labels in the path split by the '/' separator. A request is a\n match for path p if every p is an element-wise prefix of p of the\n request path. Note that if the last element of the path is a substring\n of the last element in request path, it is not a match (e.g. /foo/bar\n matches /foo/bar/baz, but does not match /foo/barbaz).\n* ImplementationSpecific: Interpretation of the Path matching is up to\n the IngressClass. Implementations can treat this as a separate PathType\n or treat it identically to Prefix or Exact path types.\nImplementations are required to support all path types.",
|
||||
"backend": "Backend defines the referenced service endpoint to which the traffic will be forwarded to.",
|
||||
}
|
||||
|
||||
func (HTTPIngressPath) SwaggerDoc() map[string]string {
|
||||
return map_HTTPIngressPath
|
||||
}
|
||||
|
||||
var map_HTTPIngressRuleValue = map[string]string{
|
||||
"": "HTTPIngressRuleValue is a list of http selectors pointing to backends. In the example: http://<host>/<path>?<searchpart> -> backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last '/' and before the first '?' or '#'.",
|
||||
"paths": "A collection of paths that map requests to backends.",
|
||||
}
|
||||
|
||||
func (HTTPIngressRuleValue) SwaggerDoc() map[string]string {
|
||||
return map_HTTPIngressRuleValue
|
||||
}
|
||||
|
||||
var map_IPBlock = map[string]string{
|
||||
"": "IPBlock describes a particular CIDR (Ex. \"192.168.1.1/24\",\"2001:db9::/64\") that is allowed to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should not be included within this rule.",
|
||||
"cidr": "CIDR is a string representing the IP Block Valid examples are \"192.168.1.1/24\" or \"2001:db9::/64\"",
|
||||
@ -37,6 +57,125 @@ func (IPBlock) SwaggerDoc() map[string]string {
|
||||
return map_IPBlock
|
||||
}
|
||||
|
||||
var map_Ingress = map[string]string{
|
||||
"": "Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"spec": "Spec is the desired state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||
"status": "Status is the current state of the Ingress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||
}
|
||||
|
||||
func (Ingress) SwaggerDoc() map[string]string {
|
||||
return map_Ingress
|
||||
}
|
||||
|
||||
var map_IngressBackend = map[string]string{
|
||||
"": "IngressBackend describes all endpoints for a given service and port.",
|
||||
"service": "Service references a Service as a Backend. This is a mutually exclusive setting with \"Resource\".",
|
||||
"resource": "Resource is an ObjectRef to another Kubernetes resource in the namespace of the Ingress object. If resource is specified, a service.Name and service.Port must not be specified. This is a mutually exclusive setting with \"Service\".",
|
||||
}
|
||||
|
||||
func (IngressBackend) SwaggerDoc() map[string]string {
|
||||
return map_IngressBackend
|
||||
}
|
||||
|
||||
var map_IngressClass = map[string]string{
|
||||
"": "IngressClass represents the class of the Ingress, referenced by the Ingress Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be used to indicate that an IngressClass should be considered default. When a single IngressClass resource has this annotation set to true, new Ingress resources without a class specified will be assigned this default class.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"spec": "Spec is the desired state of the IngressClass. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
|
||||
}
|
||||
|
||||
func (IngressClass) SwaggerDoc() map[string]string {
|
||||
return map_IngressClass
|
||||
}
|
||||
|
||||
var map_IngressClassList = map[string]string{
|
||||
"": "IngressClassList is a collection of IngressClasses.",
|
||||
"metadata": "Standard list metadata.",
|
||||
"items": "Items is the list of IngressClasses.",
|
||||
}
|
||||
|
||||
func (IngressClassList) SwaggerDoc() map[string]string {
|
||||
return map_IngressClassList
|
||||
}
|
||||
|
||||
var map_IngressClassSpec = map[string]string{
|
||||
"": "IngressClassSpec provides information about the class of an Ingress.",
|
||||
"controller": "Controller refers to the name of the controller that should handle this class. This allows for different \"flavors\" that are controlled by the same controller. For example, you may have different Parameters for the same implementing controller. This should be specified as a domain-prefixed path no more than 250 characters in length, e.g. \"acme.io/ingress-controller\". This field is immutable.",
|
||||
"parameters": "Parameters is a link to a custom resource containing additional configuration for the controller. This is optional if the controller does not require extra parameters.",
|
||||
}
|
||||
|
||||
func (IngressClassSpec) SwaggerDoc() map[string]string {
|
||||
return map_IngressClassSpec
|
||||
}
|
||||
|
||||
var map_IngressList = map[string]string{
|
||||
"": "IngressList is a collection of Ingress.",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
"items": "Items is the list of Ingress.",
|
||||
}
|
||||
|
||||
func (IngressList) SwaggerDoc() map[string]string {
|
||||
return map_IngressList
|
||||
}
|
||||
|
||||
var map_IngressRule = map[string]string{
|
||||
"": "IngressRule represents the rules mapping the paths under a specified host to the related backend services. Incoming requests are first evaluated for a host match, then routed to the backend associated with the matching IngressRuleValue.",
|
||||
"host": "Host is the fully qualified domain name of a network host, as defined by RFC 3986. Note the following deviations from the \"host\" part of the URI as defined in RFC 3986: 1. IPs are not allowed. Currently an IngressRuleValue can only apply to\n the IP in the Spec of the parent Ingress.\n2. The `:` delimiter is not respected because ports are not allowed.\n\t Currently the port of an Ingress is implicitly :80 for http and\n\t :443 for https.\nBoth these may change in the future. Incoming requests are matched against the host before the IngressRuleValue. If the host is unspecified, the Ingress routes all traffic based on the specified IngressRuleValue.\n\nHost can be \"precise\" which is a domain name without the terminating dot of a network host (e.g. \"foo.bar.com\") or \"wildcard\", which is a domain name prefixed with a single wildcard label (e.g. \"*.foo.com\"). The wildcard character '*' must appear by itself as the first DNS label and matches only a single label. You cannot have a wildcard label by itself (e.g. Host == \"*\"). Requests will be matched against the Host field in the following way: 1. If Host is precise, the request matches this rule if the http host header is equal to Host. 2. If Host is a wildcard, then the request matches this rule if the http host header is to equal to the suffix (removing the first label) of the wildcard rule.",
|
||||
}
|
||||
|
||||
func (IngressRule) SwaggerDoc() map[string]string {
|
||||
return map_IngressRule
|
||||
}
|
||||
|
||||
var map_IngressRuleValue = map[string]string{
|
||||
"": "IngressRuleValue represents a rule to apply against incoming requests. If the rule is satisfied, the request is routed to the specified backend. Currently mixing different types of rules in a single Ingress is disallowed, so exactly one of the following must be set.",
|
||||
}
|
||||
|
||||
func (IngressRuleValue) SwaggerDoc() map[string]string {
|
||||
return map_IngressRuleValue
|
||||
}
|
||||
|
||||
var map_IngressServiceBackend = map[string]string{
|
||||
"": "IngressServiceBackend references a Kubernetes Service as a Backend.",
|
||||
"name": "Name is the referenced service. The service must exist in the same namespace as the Ingress object.",
|
||||
"port": "Port of the referenced service. A port name or port number is required for a IngressServiceBackend.",
|
||||
}
|
||||
|
||||
func (IngressServiceBackend) SwaggerDoc() map[string]string {
|
||||
return map_IngressServiceBackend
|
||||
}
|
||||
|
||||
var map_IngressSpec = map[string]string{
|
||||
"": "IngressSpec describes the Ingress the user wishes to exist.",
|
||||
"ingressClassName": "IngressClassName is the name of the IngressClass cluster resource. The associated IngressClass defines which controller will implement the resource. This replaces the deprecated `kubernetes.io/ingress.class` annotation. For backwards compatibility, when that annotation is set, it must be given precedence over this field. The controller may emit a warning if the field and annotation have different values. Implementations of this API should ignore Ingresses without a class specified. An IngressClass resource may be marked as default, which can be used to set a default value for this field. For more information, refer to the IngressClass documentation.",
|
||||
"defaultBackend": "DefaultBackend is the backend that should handle requests that don't match any rule. If Rules are not specified, DefaultBackend must be specified. If DefaultBackend is not set, the handling of requests that do not match any of the rules will be up to the Ingress controller.",
|
||||
"tls": "TLS configuration. Currently the Ingress only supports a single TLS port, 443. If multiple members of this list specify different hosts, they will be multiplexed on the same port according to the hostname specified through the SNI TLS extension, if the ingress controller fulfilling the ingress supports SNI.",
|
||||
"rules": "A list of host rules used to configure the Ingress. If unspecified, or no rule matches, all traffic is sent to the default backend.",
|
||||
}
|
||||
|
||||
func (IngressSpec) SwaggerDoc() map[string]string {
|
||||
return map_IngressSpec
|
||||
}
|
||||
|
||||
var map_IngressStatus = map[string]string{
|
||||
"": "IngressStatus describe the current state of the Ingress.",
|
||||
"loadBalancer": "LoadBalancer contains the current status of the load-balancer.",
|
||||
}
|
||||
|
||||
func (IngressStatus) SwaggerDoc() map[string]string {
|
||||
return map_IngressStatus
|
||||
}
|
||||
|
||||
var map_IngressTLS = map[string]string{
|
||||
"": "IngressTLS describes the transport layer security associated with an Ingress.",
|
||||
"hosts": "Hosts are a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified.",
|
||||
"secretName": "SecretName is the name of the secret used to terminate TLS traffic on port 443. Field is left optional to allow TLS routing based on SNI hostname alone. If the SNI host in a listener conflicts with the \"Host\" header field used by an IngressRule, the SNI host is used for termination and value of the Host header is used for routing.",
|
||||
}
|
||||
|
||||
func (IngressTLS) SwaggerDoc() map[string]string {
|
||||
return map_IngressTLS
|
||||
}
|
||||
|
||||
var map_NetworkPolicy = map[string]string{
|
||||
"": "NetworkPolicy describes what network traffic is allowed for a set of Pods",
|
||||
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
|
||||
@ -110,4 +249,14 @@ func (NetworkPolicySpec) SwaggerDoc() map[string]string {
|
||||
return map_NetworkPolicySpec
|
||||
}
|
||||
|
||||
var map_ServiceBackendPort = map[string]string{
|
||||
"": "ServiceBackendPort is the service port being referenced.",
|
||||
"name": "Name is the name of the port on the Service. This is a mutually exclusive setting with \"Number\".",
|
||||
"number": "Number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with \"Name\".",
|
||||
}
|
||||
|
||||
func (ServiceBackendPort) SwaggerDoc() map[string]string {
|
||||
return map_ServiceBackendPort
|
||||
}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
|
@ -27,6 +27,51 @@ import (
|
||||
intstr "k8s.io/apimachinery/pkg/util/intstr"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPIngressPath) DeepCopyInto(out *HTTPIngressPath) {
|
||||
*out = *in
|
||||
if in.PathType != nil {
|
||||
in, out := &in.PathType, &out.PathType
|
||||
*out = new(PathType)
|
||||
**out = **in
|
||||
}
|
||||
in.Backend.DeepCopyInto(&out.Backend)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPIngressPath.
|
||||
func (in *HTTPIngressPath) DeepCopy() *HTTPIngressPath {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPIngressPath)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPIngressRuleValue) DeepCopyInto(out *HTTPIngressRuleValue) {
|
||||
*out = *in
|
||||
if in.Paths != nil {
|
||||
in, out := &in.Paths, &out.Paths
|
||||
*out = make([]HTTPIngressPath, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPIngressRuleValue.
|
||||
func (in *HTTPIngressRuleValue) DeepCopy() *HTTPIngressRuleValue {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPIngressRuleValue)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IPBlock) DeepCopyInto(out *IPBlock) {
|
||||
*out = *in
|
||||
@ -48,6 +93,307 @@ func (in *IPBlock) DeepCopy() *IPBlock {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Ingress) DeepCopyInto(out *Ingress) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Ingress.
|
||||
func (in *Ingress) DeepCopy() *Ingress {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Ingress)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Ingress) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressBackend) DeepCopyInto(out *IngressBackend) {
|
||||
*out = *in
|
||||
if in.Service != nil {
|
||||
in, out := &in.Service, &out.Service
|
||||
*out = new(IngressServiceBackend)
|
||||
**out = **in
|
||||
}
|
||||
if in.Resource != nil {
|
||||
in, out := &in.Resource, &out.Resource
|
||||
*out = new(corev1.TypedLocalObjectReference)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressBackend.
|
||||
func (in *IngressBackend) DeepCopy() *IngressBackend {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressBackend)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressClass) DeepCopyInto(out *IngressClass) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressClass.
|
||||
func (in *IngressClass) DeepCopy() *IngressClass {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressClass)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IngressClass) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressClassList) DeepCopyInto(out *IngressClassList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]IngressClass, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressClassList.
|
||||
func (in *IngressClassList) DeepCopy() *IngressClassList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressClassList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IngressClassList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressClassSpec) DeepCopyInto(out *IngressClassSpec) {
|
||||
*out = *in
|
||||
if in.Parameters != nil {
|
||||
in, out := &in.Parameters, &out.Parameters
|
||||
*out = new(corev1.TypedLocalObjectReference)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressClassSpec.
|
||||
func (in *IngressClassSpec) DeepCopy() *IngressClassSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressClassSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressList) DeepCopyInto(out *IngressList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Ingress, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressList.
|
||||
func (in *IngressList) DeepCopy() *IngressList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *IngressList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressRule) DeepCopyInto(out *IngressRule) {
|
||||
*out = *in
|
||||
in.IngressRuleValue.DeepCopyInto(&out.IngressRuleValue)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRule.
|
||||
func (in *IngressRule) DeepCopy() *IngressRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressRuleValue) DeepCopyInto(out *IngressRuleValue) {
|
||||
*out = *in
|
||||
if in.HTTP != nil {
|
||||
in, out := &in.HTTP, &out.HTTP
|
||||
*out = new(HTTPIngressRuleValue)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressRuleValue.
|
||||
func (in *IngressRuleValue) DeepCopy() *IngressRuleValue {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressRuleValue)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressServiceBackend) DeepCopyInto(out *IngressServiceBackend) {
|
||||
*out = *in
|
||||
out.Port = in.Port
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressServiceBackend.
|
||||
func (in *IngressServiceBackend) DeepCopy() *IngressServiceBackend {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressServiceBackend)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressSpec) DeepCopyInto(out *IngressSpec) {
|
||||
*out = *in
|
||||
if in.IngressClassName != nil {
|
||||
in, out := &in.IngressClassName, &out.IngressClassName
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.DefaultBackend != nil {
|
||||
in, out := &in.DefaultBackend, &out.DefaultBackend
|
||||
*out = new(IngressBackend)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.TLS != nil {
|
||||
in, out := &in.TLS, &out.TLS
|
||||
*out = make([]IngressTLS, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]IngressRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressSpec.
|
||||
func (in *IngressSpec) DeepCopy() *IngressSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressStatus) DeepCopyInto(out *IngressStatus) {
|
||||
*out = *in
|
||||
in.LoadBalancer.DeepCopyInto(&out.LoadBalancer)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressStatus.
|
||||
func (in *IngressStatus) DeepCopy() *IngressStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *IngressTLS) DeepCopyInto(out *IngressTLS) {
|
||||
*out = *in
|
||||
if in.Hosts != nil {
|
||||
in, out := &in.Hosts, &out.Hosts
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IngressTLS.
|
||||
func (in *IngressTLS) DeepCopy() *IngressTLS {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(IngressTLS)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NetworkPolicy) DeepCopyInto(out *NetworkPolicy) {
|
||||
*out = *in
|
||||
@ -260,3 +606,19 @@ func (in *NetworkPolicySpec) DeepCopy() *NetworkPolicySpec {
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceBackendPort) DeepCopyInto(out *ServiceBackendPort) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceBackendPort.
|
||||
func (in *ServiceBackendPort) DeepCopy() *ServiceBackendPort {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceBackendPort)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
105
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.Ingress.json
vendored
Normal file
105
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.Ingress.json
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
{
|
||||
"kind": "Ingress",
|
||||
"apiVersion": "networking.k8s.io/v1",
|
||||
"metadata": {
|
||||
"name": "2",
|
||||
"generateName": "3",
|
||||
"namespace": "4",
|
||||
"selfLink": "5",
|
||||
"uid": "7",
|
||||
"resourceVersion": "11042405498087606203",
|
||||
"generation": 8071137005907523419,
|
||||
"creationTimestamp": null,
|
||||
"deletionGracePeriodSeconds": -4955867275792137171,
|
||||
"labels": {
|
||||
"7": "8"
|
||||
},
|
||||
"annotations": {
|
||||
"9": "10"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "11",
|
||||
"kind": "12",
|
||||
"name": "13",
|
||||
"uid": "Dz廔ȇ{sŊƏp",
|
||||
"controller": false,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
],
|
||||
"finalizers": [
|
||||
"14"
|
||||
],
|
||||
"clusterName": "15",
|
||||
"managedFields": [
|
||||
{
|
||||
"manager": "16",
|
||||
"operation": "鐊唊飙Ş-U圴÷a/ɔ}摁(湗Ć]",
|
||||
"apiVersion": "17",
|
||||
"fieldsType": "18"
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"ingressClassName": "19",
|
||||
"defaultBackend": {
|
||||
"service": {
|
||||
"name": "20",
|
||||
"port": {
|
||||
"name": "21",
|
||||
"number": 70007838
|
||||
}
|
||||
},
|
||||
"resource": {
|
||||
"apiGroup": "22",
|
||||
"kind": "23",
|
||||
"name": "24"
|
||||
}
|
||||
},
|
||||
"tls": [
|
||||
{
|
||||
"hosts": [
|
||||
"25"
|
||||
],
|
||||
"secretName": "26"
|
||||
}
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"host": "27",
|
||||
"http": {
|
||||
"paths": [
|
||||
{
|
||||
"path": "28",
|
||||
"pathType": "晿\u003co,c鮽or",
|
||||
"backend": {
|
||||
"service": {
|
||||
"name": "29",
|
||||
"port": {
|
||||
"name": "30",
|
||||
"number": -1317363107
|
||||
}
|
||||
},
|
||||
"resource": {
|
||||
"apiGroup": "31",
|
||||
"kind": "32",
|
||||
"name": "33"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"loadBalancer": {
|
||||
"ingress": [
|
||||
{
|
||||
"ip": "34",
|
||||
"hostname": "35"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.Ingress.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.Ingress.pb
vendored
Normal file
Binary file not shown.
68
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.Ingress.yaml
vendored
Normal file
68
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.Ingress.yaml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
"9": "10"
|
||||
clusterName: "15"
|
||||
creationTimestamp: null
|
||||
deletionGracePeriodSeconds: -4955867275792137171
|
||||
finalizers:
|
||||
- "14"
|
||||
generateName: "3"
|
||||
generation: 8071137005907523419
|
||||
labels:
|
||||
"7": "8"
|
||||
managedFields:
|
||||
- apiVersion: "17"
|
||||
fieldsType: "18"
|
||||
manager: "16"
|
||||
operation: 鐊唊飙Ş-U圴÷a/ɔ}摁(湗Ć]
|
||||
name: "2"
|
||||
namespace: "4"
|
||||
ownerReferences:
|
||||
- apiVersion: "11"
|
||||
blockOwnerDeletion: true
|
||||
controller: false
|
||||
kind: "12"
|
||||
name: "13"
|
||||
uid: Dz廔ȇ{sŊƏp
|
||||
resourceVersion: "11042405498087606203"
|
||||
selfLink: "5"
|
||||
uid: "7"
|
||||
spec:
|
||||
defaultBackend:
|
||||
resource:
|
||||
apiGroup: "22"
|
||||
kind: "23"
|
||||
name: "24"
|
||||
service:
|
||||
name: "20"
|
||||
port:
|
||||
name: "21"
|
||||
number: 70007838
|
||||
ingressClassName: "19"
|
||||
rules:
|
||||
- host: "27"
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
resource:
|
||||
apiGroup: "31"
|
||||
kind: "32"
|
||||
name: "33"
|
||||
service:
|
||||
name: "29"
|
||||
port:
|
||||
name: "30"
|
||||
number: -1317363107
|
||||
path: "28"
|
||||
pathType: 晿<o,c鮽or
|
||||
tls:
|
||||
- hosts:
|
||||
- "25"
|
||||
secretName: "26"
|
||||
status:
|
||||
loadBalancer:
|
||||
ingress:
|
||||
- hostname: "35"
|
||||
ip: "34"
|
51
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IngressClass.json
vendored
Normal file
51
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IngressClass.json
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"kind": "IngressClass",
|
||||
"apiVersion": "networking.k8s.io/v1",
|
||||
"metadata": {
|
||||
"name": "2",
|
||||
"generateName": "3",
|
||||
"namespace": "4",
|
||||
"selfLink": "5",
|
||||
"uid": "7",
|
||||
"resourceVersion": "11042405498087606203",
|
||||
"generation": 8071137005907523419,
|
||||
"creationTimestamp": null,
|
||||
"deletionGracePeriodSeconds": -4955867275792137171,
|
||||
"labels": {
|
||||
"7": "8"
|
||||
},
|
||||
"annotations": {
|
||||
"9": "10"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "11",
|
||||
"kind": "12",
|
||||
"name": "13",
|
||||
"uid": "Dz廔ȇ{sŊƏp",
|
||||
"controller": false,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
],
|
||||
"finalizers": [
|
||||
"14"
|
||||
],
|
||||
"clusterName": "15",
|
||||
"managedFields": [
|
||||
{
|
||||
"manager": "16",
|
||||
"operation": "鐊唊飙Ş-U圴÷a/ɔ}摁(湗Ć]",
|
||||
"apiVersion": "17",
|
||||
"fieldsType": "18"
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"controller": "19",
|
||||
"parameters": {
|
||||
"apiGroup": "20",
|
||||
"kind": "21",
|
||||
"name": "22"
|
||||
}
|
||||
}
|
||||
}
|
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IngressClass.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IngressClass.pb
vendored
Normal file
Binary file not shown.
37
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IngressClass.yaml
vendored
Normal file
37
staging/src/k8s.io/api/testdata/HEAD/networking.k8s.io.v1.IngressClass.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: IngressClass
|
||||
metadata:
|
||||
annotations:
|
||||
"9": "10"
|
||||
clusterName: "15"
|
||||
creationTimestamp: null
|
||||
deletionGracePeriodSeconds: -4955867275792137171
|
||||
finalizers:
|
||||
- "14"
|
||||
generateName: "3"
|
||||
generation: 8071137005907523419
|
||||
labels:
|
||||
"7": "8"
|
||||
managedFields:
|
||||
- apiVersion: "17"
|
||||
fieldsType: "18"
|
||||
manager: "16"
|
||||
operation: 鐊唊飙Ş-U圴÷a/ɔ}摁(湗Ć]
|
||||
name: "2"
|
||||
namespace: "4"
|
||||
ownerReferences:
|
||||
- apiVersion: "11"
|
||||
blockOwnerDeletion: true
|
||||
controller: false
|
||||
kind: "12"
|
||||
name: "13"
|
||||
uid: Dz廔ȇ{sŊƏp
|
||||
resourceVersion: "11042405498087606203"
|
||||
selfLink: "5"
|
||||
uid: "7"
|
||||
spec:
|
||||
controller: "19"
|
||||
parameters:
|
||||
apiGroup: "20"
|
||||
kind: "21"
|
||||
name: "22"
|
@ -238,6 +238,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().PriorityLevelConfigurations().Informer()}, nil
|
||||
|
||||
// Group=networking.k8s.io, Version=v1
|
||||
case networkingv1.SchemeGroupVersion.WithResource("ingresses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().Ingresses().Informer()}, nil
|
||||
case networkingv1.SchemeGroupVersion.WithResource("ingressclasses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IngressClasses().Informer()}, nil
|
||||
case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil
|
||||
|
||||
|
@ -8,6 +8,8 @@ load(
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"ingress.go",
|
||||
"ingressclass.go",
|
||||
"interface.go",
|
||||
"networkpolicy.go",
|
||||
],
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
v1 "k8s.io/client-go/listers/networking/v1"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// IngressInformer provides access to a shared informer and lister for
|
||||
// Ingresses.
|
||||
type IngressInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.IngressLister
|
||||
}
|
||||
|
||||
type ingressInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewIngressInformer constructs a new informer for Ingress type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredIngressInformer constructs a new informer for Ingress type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().Ingresses(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().Ingresses(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&networkingv1.Ingress{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *ingressInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&networkingv1.Ingress{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *ingressInformer) Lister() v1.IngressLister {
|
||||
return v1.NewIngressLister(f.Informer().GetIndexer())
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
v1 "k8s.io/client-go/listers/networking/v1"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// IngressClassInformer provides access to a shared informer and lister for
|
||||
// IngressClasses.
|
||||
type IngressClassInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.IngressClassLister
|
||||
}
|
||||
|
||||
type ingressClassInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewIngressClassInformer constructs a new informer for IngressClass type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredIngressClassInformer constructs a new informer for IngressClass type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().IngressClasses().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NetworkingV1().IngressClasses().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&networkingv1.IngressClass{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *ingressClassInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&networkingv1.IngressClass{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *ingressClassInformer) Lister() v1.IngressClassLister {
|
||||
return v1.NewIngressClassLister(f.Informer().GetIndexer())
|
||||
}
|
@ -24,6 +24,10 @@ import (
|
||||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// Ingresses returns a IngressInformer.
|
||||
Ingresses() IngressInformer
|
||||
// IngressClasses returns a IngressClassInformer.
|
||||
IngressClasses() IngressClassInformer
|
||||
// NetworkPolicies returns a NetworkPolicyInformer.
|
||||
NetworkPolicies() NetworkPolicyInformer
|
||||
}
|
||||
@ -39,6 +43,16 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
||||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// Ingresses returns a IngressInformer.
|
||||
func (v *version) Ingresses() IngressInformer {
|
||||
return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// IngressClasses returns a IngressClassInformer.
|
||||
func (v *version) IngressClasses() IngressClassInformer {
|
||||
return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// NetworkPolicies returns a NetworkPolicyInformer.
|
||||
func (v *version) NetworkPolicies() NetworkPolicyInformer {
|
||||
return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
|
@ -10,6 +10,8 @@ go_library(
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"generated_expansion.go",
|
||||
"ingress.go",
|
||||
"ingressclass.go",
|
||||
"networking_client.go",
|
||||
"networkpolicy.go",
|
||||
],
|
||||
|
@ -9,6 +9,8 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"fake_ingress.go",
|
||||
"fake_ingressclass.go",
|
||||
"fake_networking_client.go",
|
||||
"fake_networkpolicy.go",
|
||||
],
|
||||
|
@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeIngresses implements IngressInterface
|
||||
type FakeIngresses struct {
|
||||
Fake *FakeNetworkingV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var ingressesResource = schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingresses"}
|
||||
|
||||
var ingressesKind = schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1", Kind: "Ingress"}
|
||||
|
||||
// Get takes name of the ingress, and returns the corresponding ingress object, and an error if there is any.
|
||||
func (c *FakeIngresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *networkingv1.Ingress, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(ingressesResource, c.ns, name), &networkingv1.Ingress{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.Ingress), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Ingresses that match those selectors.
|
||||
func (c *FakeIngresses) List(ctx context.Context, opts v1.ListOptions) (result *networkingv1.IngressList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(ingressesResource, ingressesKind, c.ns, opts), &networkingv1.IngressList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &networkingv1.IngressList{ListMeta: obj.(*networkingv1.IngressList).ListMeta}
|
||||
for _, item := range obj.(*networkingv1.IngressList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested ingresses.
|
||||
func (c *FakeIngresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(ingressesResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a ingress and creates it. Returns the server's representation of the ingress, and an error, if there is any.
|
||||
func (c *FakeIngresses) Create(ctx context.Context, ingress *networkingv1.Ingress, opts v1.CreateOptions) (result *networkingv1.Ingress, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(ingressesResource, c.ns, ingress), &networkingv1.Ingress{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.Ingress), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a ingress and updates it. Returns the server's representation of the ingress, and an error, if there is any.
|
||||
func (c *FakeIngresses) Update(ctx context.Context, ingress *networkingv1.Ingress, opts v1.UpdateOptions) (result *networkingv1.Ingress, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(ingressesResource, c.ns, ingress), &networkingv1.Ingress{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.Ingress), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeIngresses) UpdateStatus(ctx context.Context, ingress *networkingv1.Ingress, opts v1.UpdateOptions) (*networkingv1.Ingress, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(ingressesResource, "status", c.ns, ingress), &networkingv1.Ingress{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.Ingress), err
|
||||
}
|
||||
|
||||
// Delete takes name of the ingress and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeIngresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(ingressesResource, c.ns, name), &networkingv1.Ingress{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeIngresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(ingressesResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &networkingv1.IngressList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched ingress.
|
||||
func (c *FakeIngresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networkingv1.Ingress, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(ingressesResource, c.ns, name, pt, data, subresources...), &networkingv1.Ingress{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.Ingress), err
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeIngressClasses implements IngressClassInterface
|
||||
type FakeIngressClasses struct {
|
||||
Fake *FakeNetworkingV1
|
||||
}
|
||||
|
||||
var ingressclassesResource = schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingressclasses"}
|
||||
|
||||
var ingressclassesKind = schema.GroupVersionKind{Group: "networking.k8s.io", Version: "v1", Kind: "IngressClass"}
|
||||
|
||||
// Get takes name of the ingressClass, and returns the corresponding ingressClass object, and an error if there is any.
|
||||
func (c *FakeIngressClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *networkingv1.IngressClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(ingressclassesResource, name), &networkingv1.IngressClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.IngressClass), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of IngressClasses that match those selectors.
|
||||
func (c *FakeIngressClasses) List(ctx context.Context, opts v1.ListOptions) (result *networkingv1.IngressClassList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(ingressclassesResource, ingressclassesKind, opts), &networkingv1.IngressClassList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &networkingv1.IngressClassList{ListMeta: obj.(*networkingv1.IngressClassList).ListMeta}
|
||||
for _, item := range obj.(*networkingv1.IngressClassList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested ingressClasses.
|
||||
func (c *FakeIngressClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(ingressclassesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a ingressClass and creates it. Returns the server's representation of the ingressClass, and an error, if there is any.
|
||||
func (c *FakeIngressClasses) Create(ctx context.Context, ingressClass *networkingv1.IngressClass, opts v1.CreateOptions) (result *networkingv1.IngressClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(ingressclassesResource, ingressClass), &networkingv1.IngressClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.IngressClass), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a ingressClass and updates it. Returns the server's representation of the ingressClass, and an error, if there is any.
|
||||
func (c *FakeIngressClasses) Update(ctx context.Context, ingressClass *networkingv1.IngressClass, opts v1.UpdateOptions) (result *networkingv1.IngressClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(ingressclassesResource, ingressClass), &networkingv1.IngressClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.IngressClass), err
|
||||
}
|
||||
|
||||
// Delete takes name of the ingressClass and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeIngressClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(ingressclassesResource, name), &networkingv1.IngressClass{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeIngressClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(ingressclassesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &networkingv1.IngressClassList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched ingressClass.
|
||||
func (c *FakeIngressClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networkingv1.IngressClass, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(ingressclassesResource, name, pt, data, subresources...), &networkingv1.IngressClass{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*networkingv1.IngressClass), err
|
||||
}
|
@ -28,6 +28,14 @@ type FakeNetworkingV1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) Ingresses(namespace string) v1.IngressInterface {
|
||||
return &FakeIngresses{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) IngressClasses() v1.IngressClassInterface {
|
||||
return &FakeIngressClasses{c}
|
||||
}
|
||||
|
||||
func (c *FakeNetworkingV1) NetworkPolicies(namespace string) v1.NetworkPolicyInterface {
|
||||
return &FakeNetworkPolicies{c, namespace}
|
||||
}
|
||||
|
@ -18,4 +18,8 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
type IngressExpansion interface{}
|
||||
|
||||
type IngressClassExpansion interface{}
|
||||
|
||||
type NetworkPolicyExpansion interface{}
|
||||
|
@ -0,0 +1,195 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// IngressesGetter has a method to return a IngressInterface.
|
||||
// A group's client should implement this interface.
|
||||
type IngressesGetter interface {
|
||||
Ingresses(namespace string) IngressInterface
|
||||
}
|
||||
|
||||
// IngressInterface has methods to work with Ingress resources.
|
||||
type IngressInterface interface {
|
||||
Create(ctx context.Context, ingress *v1.Ingress, opts metav1.CreateOptions) (*v1.Ingress, error)
|
||||
Update(ctx context.Context, ingress *v1.Ingress, opts metav1.UpdateOptions) (*v1.Ingress, error)
|
||||
UpdateStatus(ctx context.Context, ingress *v1.Ingress, opts metav1.UpdateOptions) (*v1.Ingress, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Ingress, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.IngressList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Ingress, err error)
|
||||
IngressExpansion
|
||||
}
|
||||
|
||||
// ingresses implements IngressInterface
|
||||
type ingresses struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newIngresses returns a Ingresses
|
||||
func newIngresses(c *NetworkingV1Client, namespace string) *ingresses {
|
||||
return &ingresses{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the ingress, and returns the corresponding ingress object, and an error if there is any.
|
||||
func (c *ingresses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Ingress, err error) {
|
||||
result = &v1.Ingress{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of Ingresses that match those selectors.
|
||||
func (c *ingresses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IngressList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.IngressList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested ingresses.
|
||||
func (c *ingresses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a ingress and creates it. Returns the server's representation of the ingress, and an error, if there is any.
|
||||
func (c *ingresses) Create(ctx context.Context, ingress *v1.Ingress, opts metav1.CreateOptions) (result *v1.Ingress, err error) {
|
||||
result = &v1.Ingress{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(ingress).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a ingress and updates it. Returns the server's representation of the ingress, and an error, if there is any.
|
||||
func (c *ingresses) Update(ctx context.Context, ingress *v1.Ingress, opts metav1.UpdateOptions) (result *v1.Ingress, err error) {
|
||||
result = &v1.Ingress{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
Name(ingress.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(ingress).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *ingresses) UpdateStatus(ctx context.Context, ingress *v1.Ingress, opts metav1.UpdateOptions) (result *v1.Ingress, err error) {
|
||||
result = &v1.Ingress{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
Name(ingress.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(ingress).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the ingress and deletes it. Returns an error if one occurs.
|
||||
func (c *ingresses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *ingresses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched ingress.
|
||||
func (c *ingresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Ingress, err error) {
|
||||
result = &v1.Ingress{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("ingresses").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// IngressClassesGetter has a method to return a IngressClassInterface.
|
||||
// A group's client should implement this interface.
|
||||
type IngressClassesGetter interface {
|
||||
IngressClasses() IngressClassInterface
|
||||
}
|
||||
|
||||
// IngressClassInterface has methods to work with IngressClass resources.
|
||||
type IngressClassInterface interface {
|
||||
Create(ctx context.Context, ingressClass *v1.IngressClass, opts metav1.CreateOptions) (*v1.IngressClass, error)
|
||||
Update(ctx context.Context, ingressClass *v1.IngressClass, opts metav1.UpdateOptions) (*v1.IngressClass, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.IngressClass, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.IngressClassList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IngressClass, err error)
|
||||
IngressClassExpansion
|
||||
}
|
||||
|
||||
// ingressClasses implements IngressClassInterface
|
||||
type ingressClasses struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newIngressClasses returns a IngressClasses
|
||||
func newIngressClasses(c *NetworkingV1Client) *ingressClasses {
|
||||
return &ingressClasses{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the ingressClass, and returns the corresponding ingressClass object, and an error if there is any.
|
||||
func (c *ingressClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IngressClass, err error) {
|
||||
result = &v1.IngressClass{}
|
||||
err = c.client.Get().
|
||||
Resource("ingressclasses").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of IngressClasses that match those selectors.
|
||||
func (c *ingressClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IngressClassList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.IngressClassList{}
|
||||
err = c.client.Get().
|
||||
Resource("ingressclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested ingressClasses.
|
||||
func (c *ingressClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("ingressclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a ingressClass and creates it. Returns the server's representation of the ingressClass, and an error, if there is any.
|
||||
func (c *ingressClasses) Create(ctx context.Context, ingressClass *v1.IngressClass, opts metav1.CreateOptions) (result *v1.IngressClass, err error) {
|
||||
result = &v1.IngressClass{}
|
||||
err = c.client.Post().
|
||||
Resource("ingressclasses").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(ingressClass).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a ingressClass and updates it. Returns the server's representation of the ingressClass, and an error, if there is any.
|
||||
func (c *ingressClasses) Update(ctx context.Context, ingressClass *v1.IngressClass, opts metav1.UpdateOptions) (result *v1.IngressClass, err error) {
|
||||
result = &v1.IngressClass{}
|
||||
err = c.client.Put().
|
||||
Resource("ingressclasses").
|
||||
Name(ingressClass.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(ingressClass).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the ingressClass and deletes it. Returns an error if one occurs.
|
||||
func (c *ingressClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("ingressclasses").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *ingressClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("ingressclasses").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched ingressClass.
|
||||
func (c *ingressClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IngressClass, err error) {
|
||||
result = &v1.IngressClass{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("ingressclasses").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
@ -26,6 +26,8 @@ import (
|
||||
|
||||
type NetworkingV1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
IngressesGetter
|
||||
IngressClassesGetter
|
||||
NetworkPoliciesGetter
|
||||
}
|
||||
|
||||
@ -34,6 +36,14 @@ type NetworkingV1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) Ingresses(namespace string) IngressInterface {
|
||||
return newIngresses(c, namespace)
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) IngressClasses() IngressClassInterface {
|
||||
return newIngressClasses(c)
|
||||
}
|
||||
|
||||
func (c *NetworkingV1Client) NetworkPolicies(namespace string) NetworkPolicyInterface {
|
||||
return newNetworkPolicies(c, namespace)
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"expansion_generated.go",
|
||||
"ingress.go",
|
||||
"ingressclass.go",
|
||||
"networkpolicy.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/listers/networking/v1",
|
||||
|
@ -18,6 +18,18 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
// IngressListerExpansion allows custom methods to be added to
|
||||
// IngressLister.
|
||||
type IngressListerExpansion interface{}
|
||||
|
||||
// IngressNamespaceListerExpansion allows custom methods to be added to
|
||||
// IngressNamespaceLister.
|
||||
type IngressNamespaceListerExpansion interface{}
|
||||
|
||||
// IngressClassListerExpansion allows custom methods to be added to
|
||||
// IngressClassLister.
|
||||
type IngressClassListerExpansion interface{}
|
||||
|
||||
// NetworkPolicyListerExpansion allows custom methods to be added to
|
||||
// NetworkPolicyLister.
|
||||
type NetworkPolicyListerExpansion interface{}
|
||||
|
@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// IngressLister helps list Ingresses.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type IngressLister interface {
|
||||
// List lists all Ingresses in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.Ingress, err error)
|
||||
// Ingresses returns an object that can list and get Ingresses.
|
||||
Ingresses(namespace string) IngressNamespaceLister
|
||||
IngressListerExpansion
|
||||
}
|
||||
|
||||
// ingressLister implements the IngressLister interface.
|
||||
type ingressLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewIngressLister returns a new IngressLister.
|
||||
func NewIngressLister(indexer cache.Indexer) IngressLister {
|
||||
return &ingressLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all Ingresses in the indexer.
|
||||
func (s *ingressLister) List(selector labels.Selector) (ret []*v1.Ingress, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.Ingress))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Ingresses returns an object that can list and get Ingresses.
|
||||
func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister {
|
||||
return ingressNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// IngressNamespaceLister helps list and get Ingresses.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type IngressNamespaceLister interface {
|
||||
// List lists all Ingresses in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.Ingress, err error)
|
||||
// Get retrieves the Ingress from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1.Ingress, error)
|
||||
IngressNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// ingressNamespaceLister implements the IngressNamespaceLister
|
||||
// interface.
|
||||
type ingressNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all Ingresses in the indexer for a given namespace.
|
||||
func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1.Ingress, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.Ingress))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the Ingress from the indexer for a given namespace and name.
|
||||
func (s ingressNamespaceLister) Get(name string) (*v1.Ingress, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("ingress"), name)
|
||||
}
|
||||
return obj.(*v1.Ingress), nil
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// IngressClassLister helps list IngressClasses.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type IngressClassLister interface {
|
||||
// List lists all IngressClasses in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.IngressClass, err error)
|
||||
// Get retrieves the IngressClass from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1.IngressClass, error)
|
||||
IngressClassListerExpansion
|
||||
}
|
||||
|
||||
// ingressClassLister implements the IngressClassLister interface.
|
||||
type ingressClassLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewIngressClassLister returns a new IngressClassLister.
|
||||
func NewIngressClassLister(indexer cache.Indexer) IngressClassLister {
|
||||
return &ingressClassLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all IngressClasses in the indexer.
|
||||
func (s *ingressClassLister) List(selector labels.Selector) (ret []*v1.IngressClass, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.IngressClass))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the IngressClass from the index for a given name.
|
||||
func (s *ingressClassLister) Get(name string) (*v1.IngressClass, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("ingressclass"), name)
|
||||
}
|
||||
return obj.(*v1.IngressClass), nil
|
||||
}
|
@ -49,6 +49,7 @@ var statusData = map[schema.GroupVersionResource]string{
|
||||
gvr("", "v1", "services"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
||||
gvr("extensions", "v1beta1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
||||
gvr("networking.k8s.io", "v1beta1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
||||
gvr("networking.k8s.io", "v1", "ingresses"): `{"status": {"loadBalancer": {"ingress": [{"ip": "127.0.0.1"}]}}}`,
|
||||
gvr("autoscaling", "v1", "horizontalpodautoscalers"): `{"status": {"currentReplicas": 5}}`,
|
||||
gvr("batch", "v1beta1", "cronjobs"): `{"status": {"lastScheduleTime": null}}`,
|
||||
gvr("batch", "v2alpha1", "cronjobs"): `{"status": {"lastScheduleTime": null}}`,
|
||||
|
@ -234,6 +234,16 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
|
||||
// --
|
||||
|
||||
// k8s.io/kubernetes/pkg/apis/networking/v1
|
||||
gvr("networking.k8s.io", "v1", "ingresses"): {
|
||||
Stub: `{"metadata": {"name": "ingress3"}, "spec": {"defaultBackend": {"service":{"name":"service", "port":{"number": 5000}}}}}`,
|
||||
ExpectedEtcdPath: "/registry/ingress/" + namespace + "/ingress3",
|
||||
ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "Ingress"),
|
||||
},
|
||||
gvr("networking.k8s.io", "v1", "ingressclasses"): {
|
||||
Stub: `{"metadata": {"name": "ingressclass3"}, "spec": {"controller": "example.com/controller"}}`,
|
||||
ExpectedEtcdPath: "/registry/ingressclasses/ingressclass3",
|
||||
ExpectedGVK: gvkP("networking.k8s.io", "v1beta1", "IngressClass"),
|
||||
},
|
||||
gvr("networking.k8s.io", "v1", "networkpolicies"): {
|
||||
Stub: `{"metadata": {"name": "np2"}, "spec": {"podSelector": {"matchLabels": {"e": "f"}}}}`,
|
||||
ExpectedEtcdPath: "/registry/networkpolicies/" + namespace + "/np2",
|
||||
|
Loading…
Reference in New Issue
Block a user