From bce9dc8e066a36c047818a34b32e2355a5dfc9fa Mon Sep 17 00:00:00 2001 From: dprotaso Date: Wed, 28 Feb 2024 14:35:38 -0500 Subject: [PATCH] bump gateway-api dep to v1 --- go.mod | 10 +- go.sum | 18 +- .../github.com/evanphx/json-patch/README.md | 4 +- vendor/github.com/evanphx/json-patch/patch.go | 46 +- .../go-openapi/jsonpointer/pointer.go | 147 +- vendor/github.com/go-openapi/swag/util.go | 16 +- .../github.com/imdario/mergo/CONTRIBUTING.md | 112 ++ vendor/github.com/imdario/mergo/README.md | 53 +- vendor/github.com/imdario/mergo/SECURITY.md | 14 + vendor/github.com/imdario/mergo/map.go | 6 +- vendor/github.com/imdario/mergo/merge.go | 61 +- vendor/github.com/imdario/mergo/mergo.go | 15 +- vendor/modules.txt | 19 +- vendor/sigs.k8s.io/gateway-api/apis/v1/doc.go | 22 + .../gateway-api/apis/v1/gateway_types.go | 1082 +++++++++++++++ .../gateway-api/apis/v1/gatewayclass_types.go | 270 ++++ .../gateway-api/apis/v1/httproute_types.go | 1201 ++++++++++++++++ .../apis/v1/object_reference_types.go | 147 ++ .../gateway-api/apis/v1/shared_types.go | 738 ++++++++++ .../apis/v1/zz_generated.deepcopy.go | 1220 +++++++++++++++++ .../apis/v1/zz_generated.register.go | 71 + .../apis/v1alpha2/backendtlspolicy_types.go | 138 ++ .../apis/v1alpha2/gateway_types.go | 40 +- .../apis/v1alpha2/gatewayclass_types.go | 18 +- .../apis/v1alpha2/grpcroute_types.go | 27 +- .../apis/v1alpha2/httproute_types.go | 56 +- .../apis/v1alpha2/object_reference_types.go | 8 +- .../gateway-api/apis/v1alpha2/policy_types.go | 111 ++ .../gateway-api/apis/v1alpha2/shared_types.go | 44 +- .../apis/v1alpha2/zz_generated.deepcopy.go | 173 ++- .../apis/v1alpha2/zz_generated.register.go | 2 + .../gateway-api/apis/v1beta1/gateway_types.go | 879 +----------- .../apis/v1beta1/gatewayclass_types.go | 208 +-- .../apis/v1beta1/httproute_types.go | 1040 +------------- .../apis/v1beta1/object_reference_types.go | 103 +- .../gateway-api/apis/v1beta1/shared_types.go | 344 +---- .../apis/v1beta1/zz_generated.deepcopy.go | 1146 ++-------------- .../client/clientset/versioned/clientset.go | 13 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../versioned/typed/apis/v1/apis_client.go | 117 ++ .../clientset/versioned/typed/apis/v1/doc.go | 20 + .../versioned/typed/apis/v1/fake/doc.go | 20 + .../typed/apis/v1/fake/fake_apis_client.go | 48 + .../typed/apis/v1/fake/fake_gateway.go | 141 ++ .../typed/apis/v1/fake/fake_gatewayclass.go | 132 ++ .../typed/apis/v1/fake/fake_httproute.go | 141 ++ .../versioned/typed/apis/v1/gateway.go | 195 +++ .../versioned/typed/apis/v1/gatewayclass.go | 184 +++ .../typed/apis/v1/generated_expansion.go | 25 + .../versioned/typed/apis/v1/httproute.go | 195 +++ .../typed/apis/v1alpha2/apis_client.go | 5 + .../typed/apis/v1alpha2/backendtlspolicy.go | 195 +++ .../apis/v1alpha2/fake/fake_apis_client.go | 4 + .../v1alpha2/fake/fake_backendtlspolicy.go | 141 ++ .../apis/v1alpha2/generated_expansion.go | 2 + .../externalversions/apis/interface.go | 8 + .../externalversions/apis/v1/gateway.go | 90 ++ .../externalversions/apis/v1/gatewayclass.go | 89 ++ .../externalversions/apis/v1/httproute.go | 90 ++ .../externalversions/apis/v1/interface.go | 59 + .../apis/v1alpha2/backendtlspolicy.go | 90 ++ .../apis/v1alpha2/interface.go | 7 + .../informers/externalversions/generic.go | 13 +- .../listers/apis/v1/expansion_generated.go | 39 + .../pkg/client/listers/apis/v1/gateway.go | 99 ++ .../client/listers/apis/v1/gatewayclass.go | 68 + .../pkg/client/listers/apis/v1/httproute.go | 99 ++ .../listers/apis/v1alpha2/backendtlspolicy.go | 99 ++ .../apis/v1alpha2/expansion_generated.go | 8 + 71 files changed, 8397 insertions(+), 3659 deletions(-) create mode 100644 vendor/github.com/imdario/mergo/CONTRIBUTING.md create mode 100644 vendor/github.com/imdario/mergo/SECURITY.md create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/doc.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/gateway_types.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/gatewayclass_types.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/httproute_types.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/object_reference_types.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/shared_types.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.deepcopy.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.register.go create mode 100644 vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendtlspolicy_types.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/apis_client.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/doc.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/doc.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_apis_client.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gateway.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gatewayclass.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_httproute.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gateway.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gatewayclass.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/generated_expansion.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/httproute.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtlspolicy.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtlspolicy.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gateway.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gatewayclass.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/httproute.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/interface.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/backendtlspolicy.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/expansion_generated.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gateway.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gatewayclass.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/httproute.go create mode 100644 vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendtlspolicy.go diff --git a/go.mod b/go.mod index 570d9998d..0fd376c9f 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( knative.dev/hack v0.0.0-20240222141347-5f0998e65262 knative.dev/networking v0.0.0-20240227132105-cfb3abdd3c62 knative.dev/pkg v0.0.0-20240227021706-97fb318ab987 - sigs.k8s.io/gateway-api v0.8.1 + sigs.k8s.io/gateway-api v1.0.0 sigs.k8s.io/yaml v1.4.0 ) @@ -28,14 +28,14 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch v5.6.0+incompatible // indirect + github.com/evanphx/json-patch v5.7.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.9.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.4.1 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.22.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -44,7 +44,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - github.com/imdario/mergo v0.3.12 // indirect + github.com/imdario/mergo v0.3.16 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kelseyhightower/envconfig v1.4.0 // indirect diff --git a/go.sum b/go.sum index b82398f49..f644bc906 100644 --- a/go.sum +++ b/go.sum @@ -74,8 +74,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= -github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ2tG6yudJd8LBksgI= +github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -96,12 +96,14 @@ github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= +github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= @@ -190,8 +192,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -699,8 +701,8 @@ knative.dev/pkg v0.0.0-20240227021706-97fb318ab987/go.mod h1:RcjeKl+Pv5Ufdvs8COd rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/gateway-api v0.8.1 h1:Bo4NMAQFYkQZnHXOfufbYwbPW7b3Ic5NjpbeW6EJxuU= -sigs.k8s.io/gateway-api v0.8.1/go.mod h1:0PteDrsrgkRmr13nDqFWnev8tOysAVrwnvfFM55tSVg= +sigs.k8s.io/gateway-api v1.0.0 h1:iPTStSv41+d9p0xFydll6d7f7MOBGuqXM6p2/zVYMAs= +sigs.k8s.io/gateway-api v1.0.0/go.mod h1:4cUgr0Lnp5FZ0Cdq8FdRwCvpiWws7LVhLHGIudLlf4c= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/vendor/github.com/evanphx/json-patch/README.md b/vendor/github.com/evanphx/json-patch/README.md index 28e351693..97e319b21 100644 --- a/vendor/github.com/evanphx/json-patch/README.md +++ b/vendor/github.com/evanphx/json-patch/README.md @@ -4,7 +4,7 @@ well as for calculating & applying [RFC7396 JSON merge patches](https://tools.ietf.org/html/rfc7396). [![GoDoc](https://godoc.org/github.com/evanphx/json-patch?status.svg)](http://godoc.org/github.com/evanphx/json-patch) -[![Build Status](https://travis-ci.org/evanphx/json-patch.svg?branch=master)](https://travis-ci.org/evanphx/json-patch) +[![Build Status](https://github.com/evanphx/json-patch/actions/workflows/go.yml/badge.svg)](https://github.com/evanphx/json-patch/actions/workflows/go.yml) [![Report Card](https://goreportcard.com/badge/github.com/evanphx/json-patch)](https://goreportcard.com/report/github.com/evanphx/json-patch) # Get It! @@ -314,4 +314,4 @@ go test -cover ./... ``` Builds for pull requests are tested automatically -using [TravisCI](https://travis-ci.org/evanphx/json-patch). +using [GitHub Actions](https://github.com/evanphx/json-patch/actions/workflows/go.yml). diff --git a/vendor/github.com/evanphx/json-patch/patch.go b/vendor/github.com/evanphx/json-patch/patch.go index 4bce5936d..cd0274e1e 100644 --- a/vendor/github.com/evanphx/json-patch/patch.go +++ b/vendor/github.com/evanphx/json-patch/patch.go @@ -359,7 +359,7 @@ func findObject(pd *container, path string) (container, string) { next, ok := doc.get(decodePatchKey(part)) - if next == nil || ok != nil { + if next == nil || ok != nil || next.raw == nil { return nil, "" } @@ -568,6 +568,29 @@ func (p Patch) replace(doc *container, op Operation) error { return errors.Wrapf(err, "replace operation failed to decode path") } + if path == "" { + val := op.value() + + if val.which == eRaw { + if !val.tryDoc() { + if !val.tryAry() { + return errors.Wrapf(err, "replace operation value must be object or array") + } + } + } + + switch val.which { + case eAry: + *doc = &val.ary + case eDoc: + *doc = &val.doc + case eRaw: + return errors.Wrapf(err, "replace operation hit impossible case") + } + + return nil + } + con, key := findObject(doc, path) if con == nil { @@ -634,6 +657,25 @@ func (p Patch) test(doc *container, op Operation) error { return errors.Wrapf(err, "test operation failed to decode path") } + if path == "" { + var self lazyNode + + switch sv := (*doc).(type) { + case *partialDoc: + self.doc = *sv + self.which = eDoc + case *partialArray: + self.ary = *sv + self.which = eAry + } + + if self.equal(op.value()) { + return nil + } + + return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) + } + con, key := findObject(doc, path) if con == nil { @@ -646,7 +688,7 @@ func (p Patch) test(doc *container, op Operation) error { } if val == nil { - if op.value().raw == nil { + if op.value() == nil || op.value().raw == nil { return nil } return errors.Wrapf(ErrTestFailed, "testing value %s failed", path) diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go index 7df9853de..de60dc7dd 100644 --- a/vendor/github.com/go-openapi/jsonpointer/pointer.go +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -26,6 +26,7 @@ package jsonpointer import ( + "encoding/json" "errors" "fmt" "reflect" @@ -40,6 +41,7 @@ const ( pointerSeparator = `/` invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator + notFound = `Can't find the pointer in the document` ) var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem() @@ -48,13 +50,13 @@ var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem() // JSONPointable is an interface for structs to implement when they need to customize the // json pointer process type JSONPointable interface { - JSONLookup(string) (interface{}, error) + JSONLookup(string) (any, error) } // JSONSetable is an interface for structs to implement when they need to customize the // json pointer process type JSONSetable interface { - JSONSet(string, interface{}) error + JSONSet(string, any) error } // New creates a new json pointer for the given string @@ -81,9 +83,7 @@ func (p *Pointer) parse(jsonPointerString string) error { err = errors.New(invalidStart) } else { referenceTokens := strings.Split(jsonPointerString, pointerSeparator) - for _, referenceToken := range referenceTokens[1:] { - p.referenceTokens = append(p.referenceTokens, referenceToken) - } + p.referenceTokens = append(p.referenceTokens, referenceTokens[1:]...) } } @@ -91,26 +91,26 @@ func (p *Pointer) parse(jsonPointerString string) error { } // Get uses the pointer to retrieve a value from a JSON document -func (p *Pointer) Get(document interface{}) (interface{}, reflect.Kind, error) { +func (p *Pointer) Get(document any) (any, reflect.Kind, error) { return p.get(document, swag.DefaultJSONNameProvider) } // Set uses the pointer to set a value from a JSON document -func (p *Pointer) Set(document interface{}, value interface{}) (interface{}, error) { +func (p *Pointer) Set(document any, value any) (any, error) { return document, p.set(document, value, swag.DefaultJSONNameProvider) } // GetForToken gets a value for a json pointer token 1 level deep -func GetForToken(document interface{}, decodedToken string) (interface{}, reflect.Kind, error) { +func GetForToken(document any, decodedToken string) (any, reflect.Kind, error) { return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider) } // SetForToken gets a value for a json pointer token 1 level deep -func SetForToken(document interface{}, decodedToken string, value interface{}) (interface{}, error) { +func SetForToken(document any, decodedToken string, value any) (any, error) { return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider) } -func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { +func getSingleImpl(node any, decodedToken string, nameProvider *swag.NameProvider) (any, reflect.Kind, error) { rValue := reflect.Indirect(reflect.ValueOf(node)) kind := rValue.Kind() @@ -159,7 +159,7 @@ func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.Nam } -func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *swag.NameProvider) error { +func setSingleImpl(node, data any, decodedToken string, nameProvider *swag.NameProvider) error { rValue := reflect.Indirect(reflect.ValueOf(node)) if ns, ok := node.(JSONSetable); ok { // pointer impl @@ -210,7 +210,7 @@ func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *sw } -func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { +func (p *Pointer) get(node any, nameProvider *swag.NameProvider) (any, reflect.Kind, error) { if nameProvider == nil { nameProvider = swag.DefaultJSONNameProvider @@ -241,7 +241,7 @@ func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interf return node, kind, nil } -func (p *Pointer) set(node, data interface{}, nameProvider *swag.NameProvider) error { +func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error { knd := reflect.ValueOf(node).Kind() if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array { @@ -363,6 +363,127 @@ func (p *Pointer) String() string { return pointerString } +func (p *Pointer) Offset(document string) (int64, error) { + dec := json.NewDecoder(strings.NewReader(document)) + var offset int64 + for _, ttk := range p.DecodedTokens() { + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + offset, err = offsetSingleObject(dec, ttk) + if err != nil { + return 0, err + } + case '[': + offset, err = offsetSingleArray(dec, ttk) + if err != nil { + return 0, err + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + } + return offset, nil +} + +func offsetSingleObject(dec *json.Decoder, decodedToken string) (int64, error) { + for dec.More() { + offset := dec.InputOffset() + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + if err := drainSingle(dec); err != nil { + return 0, err + } + case '[': + if err := drainSingle(dec); err != nil { + return 0, err + } + } + case string: + if tk == decodedToken { + return offset, nil + } + default: + return 0, fmt.Errorf("invalid token %#v", tk) + } + } + return 0, fmt.Errorf("token reference %q not found", decodedToken) +} + +func offsetSingleArray(dec *json.Decoder, decodedToken string) (int64, error) { + idx, err := strconv.Atoi(decodedToken) + if err != nil { + return 0, fmt.Errorf("token reference %q is not a number: %v", decodedToken, err) + } + var i int + for i = 0; i < idx && dec.More(); i++ { + tk, err := dec.Token() + if err != nil { + return 0, err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + if err := drainSingle(dec); err != nil { + return 0, err + } + case '[': + if err := drainSingle(dec); err != nil { + return 0, err + } + } + } + } + if !dec.More() { + return 0, fmt.Errorf("token reference %q not found", decodedToken) + } + return dec.InputOffset(), nil +} + +// drainSingle drains a single level of object or array. +// The decoder has to guarantee the begining delim (i.e. '{' or '[') has been consumed. +func drainSingle(dec *json.Decoder) error { + for dec.More() { + tk, err := dec.Token() + if err != nil { + return err + } + switch tk := tk.(type) { + case json.Delim: + switch tk { + case '{': + if err := drainSingle(dec); err != nil { + return err + } + case '[': + if err := drainSingle(dec); err != nil { + return err + } + } + } + } + // Consumes the ending delim + if _, err := dec.Token(); err != nil { + return err + } + return nil +} + // Specific JSON pointer encoding here // ~0 => ~ // ~1 => / diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go index f78ab684a..d971fbe34 100644 --- a/vendor/github.com/go-openapi/swag/util.go +++ b/vendor/github.com/go-openapi/swag/util.go @@ -341,12 +341,21 @@ type zeroable interface { // IsZero returns true when the value passed into the function is a zero value. // This allows for safer checking of interface values. func IsZero(data interface{}) bool { + v := reflect.ValueOf(data) + // check for nil data + switch v.Kind() { + case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + if v.IsNil() { + return true + } + } + // check for things that have an IsZero method instead if vv, ok := data.(zeroable); ok { return vv.IsZero() } + // continue with slightly more complex reflection - v := reflect.ValueOf(data) switch v.Kind() { case reflect.String: return v.Len() == 0 @@ -358,14 +367,13 @@ func IsZero(data interface{}) bool { return v.Uint() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() case reflect.Struct, reflect.Array: return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface()) case reflect.Invalid: return true + default: + return false } - return false } // AddInitialisms add additional initialisms diff --git a/vendor/github.com/imdario/mergo/CONTRIBUTING.md b/vendor/github.com/imdario/mergo/CONTRIBUTING.md new file mode 100644 index 000000000..0a1ff9f94 --- /dev/null +++ b/vendor/github.com/imdario/mergo/CONTRIBUTING.md @@ -0,0 +1,112 @@ + +# Contributing to mergo + +First off, thanks for taking the time to contribute! ❤️ + +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 + +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> - Star the project +> - Tweet about it +> - Refer this project in your project's readme +> - Mention the project at local meetups and tell your friends/colleagues + + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [I Have a Question](#i-have-a-question) +- [I Want To Contribute](#i-want-to-contribute) +- [Reporting Bugs](#reporting-bugs) +- [Suggesting Enhancements](#suggesting-enhancements) + +## Code of Conduct + +This project and everyone participating in it is governed by the +[mergo Code of Conduct](https://github.com/imdario/mergoblob/master/CODE_OF_CONDUCT.md). +By participating, you are expected to uphold this code. Please report unacceptable behavior +to <>. + + +## I Have a Question + +> If you want to ask a question, we assume that you have read the available [Documentation](https://pkg.go.dev/github.com/imdario/mergo). + +Before you ask a question, it is best to search for existing [Issues](https://github.com/imdario/mergo/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/imdario/mergo/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + +## I Want To Contribute + +> ### Legal Notice +> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. + +### Reporting Bugs + + +#### Before Submitting a Bug Report + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. + +- Make sure that you are using the latest version. +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/imdario/mergoissues?q=label%3Abug). +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. +- Collect information about the bug: +- Stack trace (Traceback) +- OS, Platform and Version (Windows, Linux, macOS, x86, ARM) +- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. +- Possibly your input and the output +- Can you reliably reproduce the issue? And can you also reproduce it with older versions? + + +#### How Do I Submit a Good Bug Report? + +> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to . + + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- Open an [Issue](https://github.com/imdario/mergo/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. +- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone. + +### Suggesting Enhancements + +This section guides you through submitting an enhancement suggestion for mergo, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. + + +#### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a [search](https://github.com/imdario/mergo/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. + + +#### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://github.com/imdario/mergo/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. +- **Explain why this enhancement would be useful** to most mergo users. You may also want to point out the other projects that solved it better and which could serve as inspiration. + + +## Attribution +This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md index aa8cbd7ce..ffbbb62c7 100644 --- a/vendor/github.com/imdario/mergo/README.md +++ b/vendor/github.com/imdario/mergo/README.md @@ -1,18 +1,20 @@ # Mergo - -[![GoDoc][3]][4] [![GitHub release][5]][6] [![GoCard][7]][8] -[![Build Status][1]][2] -[![Coverage Status][9]][10] +[![Test status][1]][2] +[![OpenSSF Scorecard][21]][22] +[![OpenSSF Best Practices][19]][20] +[![Coverage status][9]][10] [![Sourcegraph][11]][12] -[![FOSSA Status][13]][14] +[![FOSSA status][13]][14] -[![GoCenter Kudos][15]][16] +[![GoDoc][3]][4] +[![Become my sponsor][15]][16] +[![Tidelift][17]][18] -[1]: https://travis-ci.org/imdario/mergo.png -[2]: https://travis-ci.org/imdario/mergo +[1]: https://github.com/imdario/mergo/workflows/tests/badge.svg?branch=master +[2]: https://github.com/imdario/mergo/actions/workflows/tests.yml [3]: https://godoc.org/github.com/imdario/mergo?status.svg [4]: https://godoc.org/github.com/imdario/mergo [5]: https://img.shields.io/github/release/imdario/mergo.svg @@ -25,8 +27,14 @@ [12]: https://sourcegraph.com/github.com/imdario/mergo?badge [13]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=shield [14]: https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_shield -[15]: https://search.gocenter.io/api/ui/badge/github.com%2Fimdario%2Fmergo -[16]: https://search.gocenter.io/github.com/imdario/mergo +[15]: https://img.shields.io/github/sponsors/imdario +[16]: https://github.com/sponsors/imdario +[17]: https://tidelift.com/badges/package/go/github.com%2Fimdario%2Fmergo +[18]: https://tidelift.com/subscription/pkg/go-github.com-imdario-mergo +[19]: https://bestpractices.coreinfrastructure.org/projects/7177/badge +[20]: https://bestpractices.coreinfrastructure.org/projects/7177 +[21]: https://api.securityscorecards.dev/projects/github.com/imdario/mergo/badge +[22]: https://api.securityscorecards.dev/projects/github.com/imdario/mergo A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. @@ -36,11 +44,11 @@ Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the ## Status -It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild). +It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, Microsoft, etc](https://github.com/imdario/mergo#mergo-in-the-wild). ### Important note -Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mergo/releases/tag/0.3.9). I reverted it in [0.3.10](//github.com/imdario/mergo/releases/tag/0.3.10), and I consider it stable but not bug-free. Also, this version adds suppot for go modules. +Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mergo/releases/tag/0.3.9). I reverted it in [0.3.10](//github.com/imdario/mergo/releases/tag/0.3.10), and I consider it stable but not bug-free. Also, this version adds support for go modules. Keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2), Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). I added an optional/variadic argument so that it won't break the existing code. @@ -51,9 +59,8 @@ If you were using Mergo before April 6th, 2015, please check your project works If Mergo is useful to you, consider buying me a coffee, a beer, or making a monthly donation to allow me to keep building great free software. :heart_eyes: Buy Me a Coffee at ko-fi.com -[![Beerpay](https://beerpay.io/imdario/mergo/badge.svg)](https://beerpay.io/imdario/mergo) -[![Beerpay](https://beerpay.io/imdario/mergo/make-wish.svg)](https://beerpay.io/imdario/mergo) Donate using Liberapay +Become my sponsor ### Mergo in the wild @@ -98,6 +105,8 @@ If Mergo is useful to you, consider buying me a coffee, a beer, or making a mont - [jnuthong/item_search](https://github.com/jnuthong/item_search) - [bukalapak/snowboard](https://github.com/bukalapak/snowboard) - [containerssh/containerssh](https://github.com/containerssh/containerssh) +- [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) +- [tjpnz/structbot](https://github.com/tjpnz/structbot) ## Install @@ -168,7 +177,7 @@ func main() { Note: if test are failing due missing package, please execute: - go get gopkg.in/yaml.v2 + go get gopkg.in/yaml.v3 ### Transformers @@ -218,7 +227,6 @@ func main() { } ``` - ## Contact me If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario) @@ -227,21 +235,8 @@ If I can help you, you have an idea or you are using Mergo in your projects, don Written by [Dario Castañé](http://dario.im). -## Top Contributors - -[![0](https://sourcerer.io/fame/imdario/imdario/mergo/images/0)](https://sourcerer.io/fame/imdario/imdario/mergo/links/0) -[![1](https://sourcerer.io/fame/imdario/imdario/mergo/images/1)](https://sourcerer.io/fame/imdario/imdario/mergo/links/1) -[![2](https://sourcerer.io/fame/imdario/imdario/mergo/images/2)](https://sourcerer.io/fame/imdario/imdario/mergo/links/2) -[![3](https://sourcerer.io/fame/imdario/imdario/mergo/images/3)](https://sourcerer.io/fame/imdario/imdario/mergo/links/3) -[![4](https://sourcerer.io/fame/imdario/imdario/mergo/images/4)](https://sourcerer.io/fame/imdario/imdario/mergo/links/4) -[![5](https://sourcerer.io/fame/imdario/imdario/mergo/images/5)](https://sourcerer.io/fame/imdario/imdario/mergo/links/5) -[![6](https://sourcerer.io/fame/imdario/imdario/mergo/images/6)](https://sourcerer.io/fame/imdario/imdario/mergo/links/6) -[![7](https://sourcerer.io/fame/imdario/imdario/mergo/images/7)](https://sourcerer.io/fame/imdario/imdario/mergo/links/7) - - ## License [BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE). - [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fimdario%2Fmergo.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fimdario%2Fmergo?ref=badge_large) diff --git a/vendor/github.com/imdario/mergo/SECURITY.md b/vendor/github.com/imdario/mergo/SECURITY.md new file mode 100644 index 000000000..a5de61f77 --- /dev/null +++ b/vendor/github.com/imdario/mergo/SECURITY.md @@ -0,0 +1,14 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 0.3.x | :white_check_mark: | +| < 0.3 | :x: | + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. diff --git a/vendor/github.com/imdario/mergo/map.go b/vendor/github.com/imdario/mergo/map.go index a13a7ee46..b50d5c2a4 100644 --- a/vendor/github.com/imdario/mergo/map.go +++ b/vendor/github.com/imdario/mergo/map.go @@ -44,7 +44,7 @@ func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, conf } } // Remember, remember... - visited[h] = &visit{addr, typ, seen} + visited[h] = &visit{typ, seen, addr} } zeroValue := reflect.Value{} switch dst.Kind() { @@ -58,7 +58,7 @@ func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, conf } fieldName := field.Name fieldName = changeInitialCase(fieldName, unicode.ToLower) - if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v)) || overwrite) { + if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v), !config.ShouldNotDereference) || overwrite) { dstMap[fieldName] = src.Field(i).Interface() } } @@ -142,7 +142,7 @@ func MapWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { func _map(dst, src interface{}, opts ...func(*Config)) error { if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { - return ErrNonPointerAgument + return ErrNonPointerArgument } var ( vDst, vSrc reflect.Value diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go index 8c2a8fcd9..0ef9b2138 100644 --- a/vendor/github.com/imdario/mergo/merge.go +++ b/vendor/github.com/imdario/mergo/merge.go @@ -38,10 +38,11 @@ func isExportedComponent(field *reflect.StructField) bool { } type Config struct { + Transformers Transformers Overwrite bool + ShouldNotDereference bool AppendSlice bool TypeCheck bool - Transformers Transformers overwriteWithEmptyValue bool overwriteSliceWithEmptyValue bool sliceDeepCopy bool @@ -76,10 +77,10 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co } } // Remember, remember... - visited[h] = &visit{addr, typ, seen} + visited[h] = &visit{typ, seen, addr} } - if config.Transformers != nil && !isEmptyValue(dst) { + if config.Transformers != nil && !isReflectNil(dst) && dst.IsValid() { if fn := config.Transformers.Transformer(dst.Type()); fn != nil { err = fn(dst, src) return @@ -95,7 +96,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co } } } else { - if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) { + if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc) { dst.Set(src) } } @@ -110,7 +111,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co } if src.Kind() != reflect.Map { - if overwrite { + if overwrite && dst.CanSet() { dst.Set(src) } return @@ -162,7 +163,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co dstSlice = reflect.ValueOf(dstElement.Interface()) } - if (!isEmptyValue(src) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice && !sliceDeepCopy { + if (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) && !config.AppendSlice && !sliceDeepCopy { if typeCheck && srcSlice.Type() != dstSlice.Type() { return fmt.Errorf("cannot override two slices with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) } @@ -194,22 +195,38 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co dst.SetMapIndex(key, dstSlice) } } - if dstElement.IsValid() && !isEmptyValue(dstElement) && (reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map || reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Slice) { - continue + + if dstElement.IsValid() && !isEmptyValue(dstElement, !config.ShouldNotDereference) { + if reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Slice { + continue + } + if reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map && reflect.TypeOf(dstElement.Interface()).Kind() == reflect.Map { + continue + } } - if srcElement.IsValid() && ((srcElement.Kind() != reflect.Ptr && overwrite) || !dstElement.IsValid() || isEmptyValue(dstElement)) { + if srcElement.IsValid() && ((srcElement.Kind() != reflect.Ptr && overwrite) || !dstElement.IsValid() || isEmptyValue(dstElement, !config.ShouldNotDereference)) { if dst.IsNil() { dst.Set(reflect.MakeMap(dst.Type())) } dst.SetMapIndex(key, srcElement) } } + + // Ensure that all keys in dst are deleted if they are not in src. + if overwriteWithEmptySrc { + for _, key := range dst.MapKeys() { + srcElement := src.MapIndex(key) + if !srcElement.IsValid() { + dst.SetMapIndex(key, reflect.Value{}) + } + } + } case reflect.Slice: if !dst.CanSet() { break } - if (!isEmptyValue(src) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice && !sliceDeepCopy { + if (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc || overwriteSliceWithEmptySrc) && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) && !config.AppendSlice && !sliceDeepCopy { dst.Set(src) } else if config.AppendSlice { if src.Type() != dst.Type() { @@ -244,12 +261,18 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co if src.Kind() != reflect.Interface { if dst.IsNil() || (src.Kind() != reflect.Ptr && overwrite) { - if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + if dst.CanSet() && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) { dst.Set(src) } } else if src.Kind() == reflect.Ptr { - if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { - return + if !config.ShouldNotDereference { + if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { + return + } + } else { + if overwriteWithEmptySrc || (overwrite && !src.IsNil()) || dst.IsNil() { + dst.Set(src) + } } } else if dst.Elem().Type() == src.Type() { if err = deepMerge(dst.Elem(), src, visited, depth+1, config); err != nil { @@ -262,7 +285,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co } if dst.IsNil() || overwrite { - if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + if dst.CanSet() && (overwrite || isEmptyValue(dst, !config.ShouldNotDereference)) { dst.Set(src) } break @@ -275,7 +298,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co break } default: - mustSet := (isEmptyValue(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) + mustSet := (isEmptyValue(dst, !config.ShouldNotDereference) || overwrite) && (!isEmptyValue(src, !config.ShouldNotDereference) || overwriteWithEmptySrc) if mustSet { if dst.CanSet() { dst.Set(src) @@ -326,6 +349,12 @@ func WithOverrideEmptySlice(config *Config) { config.overwriteSliceWithEmptyValue = true } +// WithoutDereference prevents dereferencing pointers when evaluating whether they are empty +// (i.e. a non-nil pointer is never considered empty). +func WithoutDereference(config *Config) { + config.ShouldNotDereference = true +} + // WithAppendSlice will make merge append slices instead of overwriting it. func WithAppendSlice(config *Config) { config.AppendSlice = true @@ -344,7 +373,7 @@ func WithSliceDeepCopy(config *Config) { func merge(dst, src interface{}, opts ...func(*Config)) error { if dst != nil && reflect.ValueOf(dst).Kind() != reflect.Ptr { - return ErrNonPointerAgument + return ErrNonPointerArgument } var ( vDst, vSrc reflect.Value diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go index 3cc926c7f..0a721e2d8 100644 --- a/vendor/github.com/imdario/mergo/mergo.go +++ b/vendor/github.com/imdario/mergo/mergo.go @@ -17,10 +17,10 @@ import ( var ( ErrNilArguments = errors.New("src and dst must not be nil") ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") - ErrNotSupported = errors.New("only structs and maps are supported") + ErrNotSupported = errors.New("only structs, maps, and slices are supported") ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") - ErrNonPointerAgument = errors.New("dst must be a pointer") + ErrNonPointerArgument = errors.New("dst must be a pointer") ) // During deepMerge, must keep track of checks that are @@ -28,13 +28,13 @@ var ( // checks in progress are true when it reencounters them. // Visited are stored in a map indexed by 17 * a1 + a2; type visit struct { - ptr uintptr typ reflect.Type next *visit + ptr uintptr } // From src/pkg/encoding/json/encode.go. -func isEmptyValue(v reflect.Value) bool { +func isEmptyValue(v reflect.Value, shouldDereference bool) bool { switch v.Kind() { case reflect.Array, reflect.Map, reflect.Slice, reflect.String: return v.Len() == 0 @@ -50,7 +50,10 @@ func isEmptyValue(v reflect.Value) bool { if v.IsNil() { return true } - return isEmptyValue(v.Elem()) + if shouldDereference { + return isEmptyValue(v.Elem(), shouldDereference) + } + return false case reflect.Func: return v.IsNil() case reflect.Invalid: @@ -65,7 +68,7 @@ func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { return } vDst = reflect.ValueOf(dst).Elem() - if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map { + if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map && vDst.Kind() != reflect.Slice { err = ErrNotSupported return } diff --git a/vendor/modules.txt b/vendor/modules.txt index dc74555f6..35150b15b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -31,7 +31,7 @@ github.com/davecgh/go-spew/spew ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log -# github.com/evanphx/json-patch v5.6.0+incompatible +# github.com/evanphx/json-patch v5.7.0+incompatible ## explicit github.com/evanphx/json-patch # github.com/evanphx/json-patch/v5 v5.9.0 @@ -48,14 +48,14 @@ github.com/go-logfmt/logfmt # github.com/go-logr/logr v1.4.1 ## explicit; go 1.18 github.com/go-logr/logr -# github.com/go-openapi/jsonpointer v0.19.6 -## explicit; go 1.13 +# github.com/go-openapi/jsonpointer v0.20.0 +## explicit; go 1.18 github.com/go-openapi/jsonpointer # github.com/go-openapi/jsonreference v0.20.2 ## explicit; go 1.13 github.com/go-openapi/jsonreference github.com/go-openapi/jsonreference/internal -# github.com/go-openapi/swag v0.22.3 +# github.com/go-openapi/swag v0.22.4 ## explicit; go 1.18 github.com/go-openapi/swag # github.com/gogo/protobuf v1.3.2 @@ -106,7 +106,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/utilities ## explicit; go 1.12 github.com/hashicorp/golang-lru github.com/hashicorp/golang-lru/simplelru -# github.com/imdario/mergo v0.3.12 +# github.com/imdario/mergo v0.3.16 ## explicit; go 1.13 github.com/imdario/mergo # github.com/josharian/intern v1.0.0 @@ -1005,22 +1005,27 @@ knative.dev/pkg/tracker knative.dev/pkg/version knative.dev/pkg/webhook knative.dev/pkg/webhook/certificates/resources -# sigs.k8s.io/gateway-api v0.8.1 -## explicit; go 1.20 +# sigs.k8s.io/gateway-api v1.0.0 +## explicit; go 1.21 +sigs.k8s.io/gateway-api/apis/v1 sigs.k8s.io/gateway-api/apis/v1alpha2 sigs.k8s.io/gateway-api/apis/v1beta1 sigs.k8s.io/gateway-api/pkg/client/clientset/versioned sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme +sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1 +sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2 sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1 sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake sigs.k8s.io/gateway-api/pkg/client/informers/externalversions sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis +sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1 sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2 sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1beta1 sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces +sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1 sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2 sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1 # sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/doc.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/doc.go new file mode 100644 index 000000000..bd223cd9a --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/doc.go @@ -0,0 +1,22 @@ +/* +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 v1 contains API Schema definitions for the gateway.networking.k8s.io +// API group. +// +// +kubebuilder:object:generate=true +// +groupName=gateway.networking.k8s.io +package v1 diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/gateway_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/gateway_types.go new file mode 100644 index 000000000..20cca8eca --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/gateway_types.go @@ -0,0 +1,1082 @@ +/* +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories=gateway-api,shortName=gtw +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName` +// +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value` +// +kubebuilder:printcolumn:name="Programmed",type=string,JSONPath=`.status.conditions[?(@.type=="Programmed")].status` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` + +// Gateway represents an instance of a service-traffic handling infrastructure +// by binding Listeners to a set of IP addresses. +type Gateway struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of Gateway. + Spec GatewaySpec `json:"spec"` + + // Status defines the current state of Gateway. + // + // +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}} + Status GatewayStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// GatewayList contains a list of Gateways. +type GatewayList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Gateway `json:"items"` +} + +// GatewaySpec defines the desired state of Gateway. +// +// Not all possible combinations of options specified in the Spec are +// valid. Some invalid configurations can be caught synchronously via a +// webhook, but there are many cases that will require asynchronous +// signaling via the GatewayStatus block. +type GatewaySpec struct { + // GatewayClassName used for this Gateway. This is the name of a + // GatewayClass resource. + GatewayClassName ObjectName `json:"gatewayClassName"` + + // Listeners associated with this Gateway. Listeners define + // logical endpoints that are bound on this Gateway's addresses. + // At least one Listener MUST be specified. + // + // Each Listener in a set of Listeners (for example, in a single Gateway) + // MUST be _distinct_, in that a traffic flow MUST be able to be assigned to + // exactly one listener. (This section uses "set of Listeners" rather than + // "Listeners in a single Gateway" because implementations MAY merge configuration + // from multiple Gateways onto a single data plane, and these rules _also_ + // apply in that case). + // + // Practically, this means that each listener in a set MUST have a unique + // combination of Port, Protocol, and, if supported by the protocol, Hostname. + // + // Some combinations of port, protocol, and TLS settings are considered + // Core support and MUST be supported by implementations based on their + // targeted conformance profile: + // + // HTTP Profile + // + // 1. HTTPRoute, Port: 80, Protocol: HTTP + // 2. HTTPRoute, Port: 443, Protocol: HTTPS, TLS Mode: Terminate, TLS keypair provided + // + // TLS Profile + // + // 1. TLSRoute, Port: 443, Protocol: TLS, TLS Mode: Passthrough + // + // "Distinct" Listeners have the following property: + // + // The implementation can match inbound requests to a single distinct + // Listener. When multiple Listeners share values for fields (for + // example, two Listeners with the same Port value), the implementation + // can match requests to only one of the Listeners using other + // Listener fields. + // + // For example, the following Listener scenarios are distinct: + // + // 1. Multiple Listeners with the same Port that all use the "HTTP" + // Protocol that all have unique Hostname values. + // 2. Multiple Listeners with the same Port that use either the "HTTPS" or + // "TLS" Protocol that all have unique Hostname values. + // 3. A mixture of "TCP" and "UDP" Protocol Listeners, where no Listener + // with the same Protocol has the same Port value. + // + // Some fields in the Listener struct have possible values that affect + // whether the Listener is distinct. Hostname is particularly relevant + // for HTTP or HTTPS protocols. + // + // When using the Hostname value to select between same-Port, same-Protocol + // Listeners, the Hostname value must be different on each Listener for the + // Listener to be distinct. + // + // When the Listeners are distinct based on Hostname, inbound request + // hostnames MUST match from the most specific to least specific Hostname + // values to choose the correct Listener and its associated set of Routes. + // + // Exact matches must be processed before wildcard matches, and wildcard + // matches must be processed before fallback (empty Hostname value) + // matches. For example, `"foo.example.com"` takes precedence over + // `"*.example.com"`, and `"*.example.com"` takes precedence over `""`. + // + // Additionally, if there are multiple wildcard entries, more specific + // wildcard entries must be processed before less specific wildcard entries. + // For example, `"*.foo.example.com"` takes precedence over `"*.example.com"`. + // The precise definition here is that the higher the number of dots in the + // hostname to the right of the wildcard character, the higher the precedence. + // + // The wildcard character will match any number of characters _and dots_ to + // the left, however, so `"*.example.com"` will match both + // `"foo.bar.example.com"` _and_ `"bar.example.com"`. + // + // If a set of Listeners contains Listeners that are not distinct, then those + // Listeners are Conflicted, and the implementation MUST set the "Conflicted" + // condition in the Listener Status to "True". + // + // Implementations MAY choose to accept a Gateway with some Conflicted + // Listeners only if they only accept the partial Listener set that contains + // no Conflicted Listeners. To put this another way, implementations may + // accept a partial Listener set only if they throw out *all* the conflicting + // Listeners. No picking one of the conflicting listeners as the winner. + // This also means that the Gateway must have at least one non-conflicting + // Listener in this case, otherwise it violates the requirement that at + // least one Listener must be present. + // + // The implementation MUST set a "ListenersNotValid" condition on the + // Gateway Status when the Gateway contains Conflicted Listeners whether or + // not they accept the Gateway. That Condition SHOULD clearly + // indicate in the Message which Listeners are conflicted, and which are + // Accepted. Additionally, the Listener status for those listeners SHOULD + // indicate which Listeners are conflicted and not Accepted. + // + // A Gateway's Listeners are considered "compatible" if: + // + // 1. They are distinct. + // 2. The implementation can serve them in compliance with the Addresses + // requirement that all Listeners are available on all assigned + // addresses. + // + // Compatible combinations in Extended support are expected to vary across + // implementations. A combination that is compatible for one implementation + // may not be compatible for another. + // + // For example, an implementation that cannot serve both TCP and UDP listeners + // on the same address, or cannot mix HTTPS and generic TLS listens on the same port + // would not consider those cases compatible, even though they are distinct. + // + // Note that requests SHOULD match at most one Listener. For example, if + // Listeners are defined for "foo.example.com" and "*.example.com", a + // request to "foo.example.com" SHOULD only be routed using routes attached + // to the "foo.example.com" Listener (and not the "*.example.com" Listener). + // This concept is known as "Listener Isolation". Implementations that do + // not support Listener Isolation MUST clearly document this. + // + // Implementations MAY merge separate Gateways onto a single set of + // Addresses if all Listeners across all Gateways are compatible. + // + // Support: Core + // + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=64 + // +kubebuilder:validation:XValidation:message="tls must be specified for protocols ['HTTPS', 'TLS']",rule="self.all(l, l.protocol in ['HTTPS', 'TLS'] ? has(l.tls) : true)" + // +kubebuilder:validation:XValidation:message="tls must not be specified for protocols ['HTTP', 'TCP', 'UDP']",rule="self.all(l, l.protocol in ['HTTP', 'TCP', 'UDP'] ? !has(l.tls) : true)" + // +kubebuilder:validation:XValidation:message="hostname must not be specified for protocols ['TCP', 'UDP']",rule="self.all(l, l.protocol in ['TCP', 'UDP'] ? (!has(l.hostname) || l.hostname == '') : true)" + // +kubebuilder:validation:XValidation:message="Listener name must be unique within the Gateway",rule="self.all(l1, self.exists_one(l2, l1.name == l2.name))" + // +kubebuilder:validation:XValidation:message="Combination of port, protocol and hostname must be unique for each listener",rule="self.all(l1, self.exists_one(l2, l1.port == l2.port && l1.protocol == l2.protocol && (has(l1.hostname) && has(l2.hostname) ? l1.hostname == l2.hostname : !has(l1.hostname) && !has(l2.hostname))))" + Listeners []Listener `json:"listeners"` + + // Addresses requested for this Gateway. This is optional and behavior can + // depend on the implementation. If a value is set in the spec and the + // requested address is invalid or unavailable, the implementation MUST + // indicate this in the associated entry in GatewayStatus.Addresses. + // + // The Addresses field represents a request for the address(es) on the + // "outside of the Gateway", that traffic bound for this Gateway will use. + // This could be the IP address or hostname of an external load balancer or + // other networking infrastructure, or some other address that traffic will + // be sent to. + // + // If no Addresses are specified, the implementation MAY schedule the + // Gateway in an implementation-specific manner, assigning an appropriate + // set of Addresses. + // + // The implementation MUST bind all Listeners to every GatewayAddress that + // it assigns to the Gateway and add a corresponding entry in + // GatewayStatus.Addresses. + // + // Support: Extended + // + // +optional + // + // +kubebuilder:validation:MaxItems=16 + // +kubebuilder:validation:XValidation:message="IPAddress values must be unique",rule="self.all(a1, a1.type == 'IPAddress' ? self.exists_one(a2, a2.type == a1.type && a2.value == a1.value) : true )" + // +kubebuilder:validation:XValidation:message="Hostname values must be unique",rule="self.all(a1, a1.type == 'Hostname' ? self.exists_one(a2, a2.type == a1.type && a2.value == a1.value) : true )" + Addresses []GatewayAddress `json:"addresses,omitempty"` + + // Infrastructure defines infrastructure level attributes about this Gateway instance. + // + // Support: Core + // + // + // +optional + Infrastructure *GatewayInfrastructure `json:"infrastructure,omitempty"` +} + +// Listener embodies the concept of a logical endpoint where a Gateway accepts +// network connections. +type Listener struct { + // Name is the name of the Listener. This name MUST be unique within a + // Gateway. + // + // Support: Core + Name SectionName `json:"name"` + + // Hostname specifies the virtual hostname to match for protocol types that + // define this concept. When unspecified, all hostnames are matched. This + // field is ignored for protocols that don't require hostname based + // matching. + // + // Implementations MUST apply Hostname matching appropriately for each of + // the following protocols: + // + // * TLS: The Listener Hostname MUST match the SNI. + // * HTTP: The Listener Hostname MUST match the Host header of the request. + // * HTTPS: The Listener Hostname SHOULD match at both the TLS and HTTP + // protocol layers as described above. If an implementation does not + // ensure that both the SNI and Host header match the Listener hostname, + // it MUST clearly document that. + // + // For HTTPRoute and TLSRoute resources, there is an interaction with the + // `spec.hostnames` array. When both listener and route specify hostnames, + // there MUST be an intersection between the values for a Route to be + // accepted. For more information, refer to the Route specific Hostnames + // documentation. + // + // Hostnames that are prefixed with a wildcard label (`*.`) are interpreted + // as a suffix match. That means that a match for `*.example.com` would match + // both `test.example.com`, and `foo.test.example.com`, but not `example.com`. + // + // Support: Core + // + // +optional + Hostname *Hostname `json:"hostname,omitempty"` + + // Port is the network port. Multiple listeners may use the + // same port, subject to the Listener compatibility rules. + // + // Support: Core + Port PortNumber `json:"port"` + + // Protocol specifies the network protocol this listener expects to receive. + // + // Support: Core + Protocol ProtocolType `json:"protocol"` + + // TLS is the TLS configuration for the Listener. This field is required if + // the Protocol field is "HTTPS" or "TLS". It is invalid to set this field + // if the Protocol field is "HTTP", "TCP", or "UDP". + // + // The association of SNIs to Certificate defined in GatewayTLSConfig is + // defined based on the Hostname field for this listener. + // + // The GatewayClass MUST use the longest matching SNI out of all + // available certificates for any TLS handshake. + // + // Support: Core + // + // +optional + TLS *GatewayTLSConfig `json:"tls,omitempty"` + + // AllowedRoutes defines the types of routes that MAY be attached to a + // Listener and the trusted namespaces where those Route resources MAY be + // present. + // + // Although a client request may match multiple route rules, only one rule + // may ultimately receive the request. Matching precedence MUST be + // determined in order of the following criteria: + // + // * The most specific match as defined by the Route type. + // * The oldest Route based on creation timestamp. For example, a Route with + // a creation timestamp of "2020-09-08 01:02:03" is given precedence over + // a Route with a creation timestamp of "2020-09-08 01:02:04". + // * If everything else is equivalent, the Route appearing first in + // alphabetical order (namespace/name) should be given precedence. For + // example, foo/bar is given precedence over foo/baz. + // + // All valid rules within a Route attached to this Listener should be + // implemented. Invalid Route rules can be ignored (sometimes that will mean + // the full Route). If a Route rule transitions from valid to invalid, + // support for that Route rule should be dropped to ensure consistency. For + // example, even if a filter specified by a Route rule is invalid, the rest + // of the rules within that Route should still be supported. + // + // Support: Core + // +kubebuilder:default={namespaces:{from: Same}} + // +optional + AllowedRoutes *AllowedRoutes `json:"allowedRoutes,omitempty"` +} + +// ProtocolType defines the application protocol accepted by a Listener. +// Implementations are not required to accept all the defined protocols. If an +// implementation does not support a specified protocol, it MUST set the +// "Accepted" condition to False for the affected Listener with a reason of +// "UnsupportedProtocol". +// +// Core ProtocolType values are listed in the table below. +// +// Implementations can define their own protocols if a core ProtocolType does not +// exist. Such definitions must use prefixed name, such as +// `mycompany.com/my-custom-protocol`. Un-prefixed names are reserved for core +// protocols. Any protocol defined by implementations will fall under +// Implementation-specific conformance. +// +// Valid values include: +// +// * "HTTP" - Core support +// * "example.com/bar" - Implementation-specific support +// +// Invalid values include: +// +// * "example.com" - must include path if domain is used +// * "foo.example.com" - must include path if domain is used +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=255 +// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$` +type ProtocolType string + +const ( + // Accepts cleartext HTTP/1.1 sessions over TCP. Implementations MAY also + // support HTTP/2 over cleartext. If implementations support HTTP/2 over + // cleartext on "HTTP" listeners, that MUST be clearly documented by the + // implementation. + HTTPProtocolType ProtocolType = "HTTP" + + // Accepts HTTP/1.1 or HTTP/2 sessions over TLS. + HTTPSProtocolType ProtocolType = "HTTPS" + + // Accepts TLS sessions over TCP. + TLSProtocolType ProtocolType = "TLS" + + // Accepts TCP sessions. + TCPProtocolType ProtocolType = "TCP" + + // Accepts UDP packets. + UDPProtocolType ProtocolType = "UDP" +) + +// GatewayTLSConfig describes a TLS configuration. +// +// +kubebuilder:validation:XValidation:message="certificateRefs must be specified when TLSModeType is Terminate",rule="self.mode == 'Terminate' ? size(self.certificateRefs) > 0 : true" +type GatewayTLSConfig struct { + // Mode defines the TLS behavior for the TLS session initiated by the client. + // There are two possible modes: + // + // - Terminate: The TLS session between the downstream client + // and the Gateway is terminated at the Gateway. This mode requires + // certificateRefs to be set and contain at least one element. + // - Passthrough: The TLS session is NOT terminated by the Gateway. This + // implies that the Gateway can't decipher the TLS stream except for + // the ClientHello message of the TLS protocol. + // CertificateRefs field is ignored in this mode. + // + // Support: Core + // + // +optional + // +kubebuilder:default=Terminate + Mode *TLSModeType `json:"mode,omitempty"` + + // CertificateRefs contains a series of references to Kubernetes objects that + // contains TLS certificates and private keys. These certificates are used to + // establish a TLS handshake for requests that match the hostname of the + // associated listener. + // + // A single CertificateRef to a Kubernetes Secret has "Core" support. + // Implementations MAY choose to support attaching multiple certificates to + // a Listener, but this behavior is implementation-specific. + // + // References to a resource in different namespace are invalid UNLESS there + // is a ReferenceGrant in the target namespace that allows the certificate + // to be attached. If a ReferenceGrant does not allow this reference, the + // "ResolvedRefs" condition MUST be set to False for this listener with the + // "RefNotPermitted" reason. + // + // This field is required to have at least one element when the mode is set + // to "Terminate" (default) and is optional otherwise. + // + // CertificateRefs can reference to standard Kubernetes resources, i.e. + // Secret, or implementation-specific custom resources. + // + // Support: Core - A single reference to a Kubernetes Secret of type kubernetes.io/tls + // + // Support: Implementation-specific (More than one reference or other resource types) + // + // +optional + // +kubebuilder:validation:MaxItems=64 + CertificateRefs []SecretObjectReference `json:"certificateRefs,omitempty"` + + // Options are a list of key/value pairs to enable extended TLS + // configuration for each implementation. For example, configuring the + // minimum TLS version or supported cipher suites. + // + // A set of common keys MAY be defined by the API in the future. To avoid + // any ambiguity, implementation-specific definitions MUST use + // domain-prefixed names, such as `example.com/my-custom-option`. + // Un-prefixed names are reserved for key names defined by Gateway API. + // + // Support: Implementation-specific + // + // +optional + // +kubebuilder:validation:MaxProperties=16 + Options map[AnnotationKey]AnnotationValue `json:"options,omitempty"` +} + +// TLSModeType type defines how a Gateway handles TLS sessions. +// +// +kubebuilder:validation:Enum=Terminate;Passthrough +type TLSModeType string + +const ( + // In this mode, TLS session between the downstream client + // and the Gateway is terminated at the Gateway. + TLSModeTerminate TLSModeType = "Terminate" + + // In this mode, the TLS session is NOT terminated by the Gateway. This + // implies that the Gateway can't decipher the TLS stream except for + // the ClientHello message of the TLS protocol. + // + // Note that SSL passthrough is only supported by TLSRoute. + TLSModePassthrough TLSModeType = "Passthrough" +) + +// AllowedRoutes defines which Routes may be attached to this Listener. +type AllowedRoutes struct { + // Namespaces indicates namespaces from which Routes may be attached to this + // Listener. This is restricted to the namespace of this Gateway by default. + // + // Support: Core + // + // +optional + // +kubebuilder:default={from: Same} + Namespaces *RouteNamespaces `json:"namespaces,omitempty"` + + // Kinds specifies the groups and kinds of Routes that are allowed to bind + // to this Gateway Listener. When unspecified or empty, the kinds of Routes + // selected are determined using the Listener protocol. + // + // A RouteGroupKind MUST correspond to kinds of Routes that are compatible + // with the application protocol specified in the Listener's Protocol field. + // If an implementation does not support or recognize this resource type, it + // MUST set the "ResolvedRefs" condition to False for this Listener with the + // "InvalidRouteKinds" reason. + // + // Support: Core + // + // +optional + // +kubebuilder:validation:MaxItems=8 + Kinds []RouteGroupKind `json:"kinds,omitempty"` +} + +// FromNamespaces specifies namespace from which Routes may be attached to a +// Gateway. +// +// +kubebuilder:validation:Enum=All;Selector;Same +type FromNamespaces string + +const ( + // Routes in all namespaces may be attached to this Gateway. + NamespacesFromAll FromNamespaces = "All" + // Only Routes in namespaces selected by the selector may be attached to + // this Gateway. + NamespacesFromSelector FromNamespaces = "Selector" + // Only Routes in the same namespace as the Gateway may be attached to this + // Gateway. + NamespacesFromSame FromNamespaces = "Same" +) + +// RouteNamespaces indicate which namespaces Routes should be selected from. +type RouteNamespaces struct { + // From indicates where Routes will be selected for this Gateway. Possible + // values are: + // + // * All: Routes in all namespaces may be used by this Gateway. + // * Selector: Routes in namespaces selected by the selector may be used by + // this Gateway. + // * Same: Only Routes in the same namespace may be used by this Gateway. + // + // Support: Core + // + // +optional + // +kubebuilder:default=Same + From *FromNamespaces `json:"from,omitempty"` + + // Selector must be specified when From is set to "Selector". In that case, + // only Routes in Namespaces matching this Selector will be selected by this + // Gateway. This field is ignored for other values of "From". + // + // Support: Core + // + // +optional + Selector *metav1.LabelSelector `json:"selector,omitempty"` +} + +// RouteGroupKind indicates the group and kind of a Route resource. +type RouteGroupKind struct { + // Group is the group of the Route. + // + // +optional + // +kubebuilder:default=gateway.networking.k8s.io + Group *Group `json:"group,omitempty"` + + // Kind is the kind of the Route. + Kind Kind `json:"kind"` +} + +// GatewayAddress describes an address that can be bound to a Gateway. +// +// +kubebuilder:validation:XValidation:message="Hostname value must only contain valid characters (matching ^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$)",rule="self.type == 'Hostname' ? self.value.matches(r\"\"\"^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\"\"\"): true" +type GatewayAddress struct { + // Type of the address. + // + // +optional + // +kubebuilder:default=IPAddress + Type *AddressType `json:"type,omitempty"` + + // Value of the address. The validity of the values will depend + // on the type and support by the controller. + // + // Examples: `1.2.3.4`, `128::1`, `my-ip-address`. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + Value string `json:"value"` +} + +// GatewayStatusAddress describes a network address that is bound to a Gateway. +// +// +kubebuilder:validation:XValidation:message="Hostname value must only contain valid characters (matching ^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$)",rule="self.type == 'Hostname' ? self.value.matches(r\"\"\"^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\"\"\"): true" +type GatewayStatusAddress struct { + // Type of the address. + // + // +optional + // +kubebuilder:default=IPAddress + Type *AddressType `json:"type,omitempty"` + + // Value of the address. The validity of the values will depend + // on the type and support by the controller. + // + // Examples: `1.2.3.4`, `128::1`, `my-ip-address`. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + Value string `json:"value"` +} + +// GatewayStatus defines the observed state of Gateway. +type GatewayStatus struct { + // Addresses lists the network addresses that have been bound to the + // Gateway. + // + // This list may differ from the addresses provided in the spec under some + // conditions: + // + // * no addresses are specified, all addresses are dynamically assigned + // * a combination of specified and dynamic addresses are assigned + // * a specified address was unusable (e.g. already in use) + // + // +optional + // + // +kubebuilder:validation:MaxItems=16 + Addresses []GatewayStatusAddress `json:"addresses,omitempty"` + + // Conditions describe the current conditions of the Gateway. + // + // Implementations should prefer to express Gateway conditions + // using the `GatewayConditionType` and `GatewayConditionReason` + // constants so that operators and tools can converge on a common + // vocabulary to describe Gateway state. + // + // Known condition types are: + // + // * "Accepted" + // * "Programmed" + // * "Ready" + // + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=8 + // +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}} + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // Listeners provide status for each unique listener port defined in the Spec. + // + // +optional + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=64 + Listeners []ListenerStatus `json:"listeners,omitempty"` +} + +// GatewayInfrastructure defines infrastructure level attributes about a Gateway instance. +type GatewayInfrastructure struct { + // Labels that SHOULD be applied to any resources created in response to this Gateway. + // + // For implementations creating other Kubernetes objects, this should be the `metadata.labels` field on resources. + // For other implementations, this refers to any relevant (implementation specific) "labels" concepts. + // + // An implementation may chose to add additional implementation-specific labels as they see fit. + // + // Support: Extended + // + // +optional + // +kubebuilder:validation:MaxProperties=8 + Labels map[AnnotationKey]AnnotationValue `json:"labels,omitempty"` + + // Annotations that SHOULD be applied to any resources created in response to this Gateway. + // + // For implementations creating other Kubernetes objects, this should be the `metadata.annotations` field on resources. + // For other implementations, this refers to any relevant (implementation specific) "annotations" concepts. + // + // An implementation may chose to add additional implementation-specific annotations as they see fit. + // + // Support: Extended + // + // +optional + // +kubebuilder:validation:MaxProperties=8 + Annotations map[AnnotationKey]AnnotationValue `json:"annotations,omitempty"` +} + +// GatewayConditionType is a type of condition associated with a +// Gateway. This type should be used with the GatewayStatus.Conditions +// field. +type GatewayConditionType string + +// GatewayConditionReason defines the set of reasons that explain why a +// particular Gateway condition type has been raised. +type GatewayConditionReason string + +const ( + // This condition indicates whether a Gateway has generated some + // configuration that is assumed to be ready soon in the underlying data + // plane. + // + // It is a positive-polarity summary condition, and so should always be + // present on the resource with ObservedGeneration set. + // + // It should be set to Unknown if the controller performs updates to the + // status before it has all the information it needs to be able to determine + // if the condition is true. + // + // Possible reasons for this condition to be True are: + // + // * "Programmed" + // + // Possible reasons for this condition to be False are: + // + // * "Invalid" + // * "Pending" + // * "NoResources" + // * "AddressNotAssigned" + // + // Possible reasons for this condition to be Unknown are: + // + // * "Pending" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + GatewayConditionProgrammed GatewayConditionType = "Programmed" + + // This reason is used with the "Programmed" condition when the condition is + // true. + GatewayReasonProgrammed GatewayConditionReason = "Programmed" + + // This reason is used with the "Programmed" and "Accepted" conditions when the Gateway is + // syntactically or semantically invalid. + GatewayReasonInvalid GatewayConditionReason = "Invalid" + + // This reason is used with the "Programmed" condition when the + // Gateway is not scheduled because insufficient infrastructure + // resources are available. + GatewayReasonNoResources GatewayConditionReason = "NoResources" + + // This reason is used with the "Programmed" condition when the underlying + // implementation and network have yet to dynamically assign addresses for a + // Gateway. + // + // Some example situations where this reason can be used: + // + // * IPAM address exhaustion + // * Address not yet allocated + // + // When this reason is used the implementation SHOULD provide a clear + // message explaining the underlying problem, ideally with some hints as to + // what actions can be taken that might resolve the problem. + GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned" + + // This reason is used with the "Programmed" condition when the underlying + // implementation (and possibly, network) are unable to use an address that + // was provided in the Gateway specification. + // + // Some example situations where this reason can be used: + // + // * a named address not being found + // * a provided static address can't be used + // * the address is already in use + // + // When this reason is used the implementation SHOULD provide prescriptive + // information on which address is causing the problem and how to resolve it + // in the condition message. + GatewayReasonAddressNotUsable GatewayConditionReason = "AddressNotUsable" +) + +const ( + // This condition is true when the controller managing the Gateway is + // syntactically and semantically valid enough to produce some configuration + // in the underlying data plane. This does not indicate whether or not the + // configuration has been propagated to the data plane. + // + // Possible reasons for this condition to be True are: + // + // * "Accepted" + // * "ListenersNotValid" + // + // Possible reasons for this condition to be False are: + // + // * "Invalid" + // * "NotReconciled" + // * "UnsupportedAddress" + // * "ListenersNotValid" + // + // Possible reasons for this condition to be Unknown are: + // + // * "Pending" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + GatewayConditionAccepted GatewayConditionType = "Accepted" + + // This reason is used with the "Accepted" condition when the condition is + // True. + GatewayReasonAccepted GatewayConditionReason = "Accepted" + + // This reason is used with the "Accepted" condition when one or + // more Listeners have an invalid or unsupported configuration + // and cannot be configured on the Gateway. + // This can be the reason when "Accepted" is "True" or "False", depending on whether + // the listener being invalid causes the entire Gateway to not be accepted. + GatewayReasonListenersNotValid GatewayConditionReason = "ListenersNotValid" + + // This reason is used with the "Accepted" and "Programmed" + // conditions when the status is "Unknown" and no controller has reconciled + // the Gateway. + GatewayReasonPending GatewayConditionReason = "Pending" + + // This reason is used with the "Accepted" condition to indicate that the + // Gateway could not be accepted because an address that was provided is a + // type which is not supported by the implementation. + GatewayReasonUnsupportedAddress GatewayConditionReason = "UnsupportedAddress" +) + +const ( + // Deprecated: use "Accepted" instead. + GatewayConditionScheduled GatewayConditionType = "Scheduled" + + // This reason is used with the "Scheduled" condition when the condition is + // True. + // + // Deprecated: use the "Accepted" condition with reason "Accepted" instead. + GatewayReasonScheduled GatewayConditionReason = "Scheduled" + + // Deprecated: Use "Pending" instead. + GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled" +) + +const ( + // "Ready" is a condition type reserved for future use. It should not be used by implementations. + // + // If used in the future, "Ready" will represent the final state where all configuration is confirmed good + // _and has completely propagated to the data plane_. That is, it is a _guarantee_ that, as soon as something + // sees the Condition as `true`, then connections will be correctly routed _immediately_. + // + // This is a very strong guarantee, and to date no implementation has satisfied it enough to implement it. + // This reservation can be discussed in the future if necessary. + // + // Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters + // to alert about usage. + // Deprecated: Ready is reserved for future use + GatewayConditionReady GatewayConditionType = "Ready" + + // Deprecated: Ready is reserved for future use + GatewayReasonReady GatewayConditionReason = "Ready" + + // Deprecated: Ready is reserved for future use + GatewayReasonListenersNotReady GatewayConditionReason = "ListenersNotReady" +) + +// ListenerStatus is the status associated with a Listener. +type ListenerStatus struct { + // Name is the name of the Listener that this status corresponds to. + Name SectionName `json:"name"` + + // SupportedKinds is the list indicating the Kinds supported by this + // listener. This MUST represent the kinds an implementation supports for + // that Listener configuration. + // + // If kinds are specified in Spec that are not supported, they MUST NOT + // appear in this list and an implementation MUST set the "ResolvedRefs" + // condition to "False" with the "InvalidRouteKinds" reason. If both valid + // and invalid Route kinds are specified, the implementation MUST + // reference the valid Route kinds that have been specified. + // + // +kubebuilder:validation:MaxItems=8 + SupportedKinds []RouteGroupKind `json:"supportedKinds"` + + // AttachedRoutes represents the total number of Routes that have been + // successfully attached to this Listener. + // + // Successful attachment of a Route to a Listener is based solely on the + // combination of the AllowedRoutes field on the corresponding Listener + // and the Route's ParentRefs field. A Route is successfully attached to + // a Listener when it is selected by the Listener's AllowedRoutes field + // AND the Route has a valid ParentRef selecting the whole Gateway + // resource or a specific Listener as a parent resource (more detail on + // attachment semantics can be found in the documentation on the various + // Route kinds ParentRefs fields). Listener or Route status does not impact + // successful attachment, i.e. the AttachedRoutes field count MUST be set + // for Listeners with condition Accepted: false and MUST count successfully + // attached Routes that may themselves have Accepted: false conditions. + // + // Uses for this field include troubleshooting Route attachment and + // measuring blast radius/impact of changes to a Listener. + AttachedRoutes int32 `json:"attachedRoutes"` + + // Conditions describe the current condition of this listener. + // + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=8 + Conditions []metav1.Condition `json:"conditions"` +} + +// ListenerConditionType is a type of condition associated with the +// listener. This type should be used with the ListenerStatus.Conditions +// field. +type ListenerConditionType string + +// ListenerConditionReason defines the set of reasons that explain +// why a particular Listener condition type has been raised. +type ListenerConditionReason string + +const ( + // This condition indicates that the controller was unable to resolve + // conflicting specification requirements for this Listener. If a + // Listener is conflicted, its network port should not be configured + // on any network elements. + // + // Possible reasons for this condition to be true are: + // + // * "HostnameConflict" + // * "ProtocolConflict" + // + // Possible reasons for this condition to be False are: + // + // * "NoConflicts" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + ListenerConditionConflicted ListenerConditionType = "Conflicted" + + // This reason is used with the "Conflicted" condition when + // the Listener conflicts with hostnames in other Listeners. For + // example, this reason would be used when multiple Listeners on + // the same port use `example.com` in the hostname field. + ListenerReasonHostnameConflict ListenerConditionReason = "HostnameConflict" + + // This reason is used with the "Conflicted" condition when + // multiple Listeners are specified with the same Listener port + // number, but have conflicting protocol specifications. + ListenerReasonProtocolConflict ListenerConditionReason = "ProtocolConflict" + + // This reason is used with the "Conflicted" condition when the condition + // is False. + ListenerReasonNoConflicts ListenerConditionReason = "NoConflicts" +) + +const ( + // This condition indicates that the listener is syntactically and + // semantically valid, and that all features used in the listener's spec are + // supported. + // + // In general, a Listener will be marked as Accepted when the supplied + // configuration will generate at least some data plane configuration. + // + // For example, a Listener with an unsupported protocol will never generate + // any data plane config, and so will have Accepted set to `false.` + // Conversely, a Listener that does not have any Routes will be able to + // generate data plane config, and so will have Accepted set to `true`. + // + // Possible reasons for this condition to be True are: + // + // * "Accepted" + // + // Possible reasons for this condition to be False are: + // + // * "PortUnavailable" + // * "UnsupportedProtocol" + // + // Possible reasons for this condition to be Unknown are: + // + // * "Pending" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + ListenerConditionAccepted ListenerConditionType = "Accepted" + + // Deprecated: use "Accepted" instead. + ListenerConditionDetached ListenerConditionType = "Detached" + + // This reason is used with the "Accepted" condition when the condition is + // True. + ListenerReasonAccepted ListenerConditionReason = "Accepted" + + // This reason is used with the "Detached" condition when the condition is + // False. + // + // Deprecated: use the "Accepted" condition with reason "Accepted" instead. + ListenerReasonAttached ListenerConditionReason = "Attached" + + // This reason is used with the "Accepted" condition when the Listener + // requests a port that cannot be used on the Gateway. This reason could be + // used in a number of instances, including: + // + // * The port is already in use. + // * The port is not supported by the implementation. + ListenerReasonPortUnavailable ListenerConditionReason = "PortUnavailable" + + // This reason is used with the "Accepted" condition when the + // Listener could not be attached to be Gateway because its + // protocol type is not supported. + ListenerReasonUnsupportedProtocol ListenerConditionReason = "UnsupportedProtocol" +) + +const ( + // This condition indicates whether the controller was able to + // resolve all the object references for the Listener. + // + // Possible reasons for this condition to be true are: + // + // * "ResolvedRefs" + // + // Possible reasons for this condition to be False are: + // + // * "InvalidCertificateRef" + // * "InvalidRouteKinds" + // * "RefNotPermitted" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + ListenerConditionResolvedRefs ListenerConditionType = "ResolvedRefs" + + // This reason is used with the "ResolvedRefs" condition when the condition + // is true. + ListenerReasonResolvedRefs ListenerConditionReason = "ResolvedRefs" + + // This reason is used with the "ResolvedRefs" condition when the + // Listener has a TLS configuration with at least one TLS CertificateRef + // that is invalid or does not exist. + // A CertificateRef is considered invalid when it refers to a nonexistent + // or unsupported resource or kind, or when the data within that resource + // is malformed. + // This reason must be used only when the reference is allowed, either by + // referencing an object in the same namespace as the Gateway, or when + // a cross-namespace reference has been explicitly allowed by a ReferenceGrant. + // If the reference is not allowed, the reason RefNotPermitted must be used + // instead. + ListenerReasonInvalidCertificateRef ListenerConditionReason = "InvalidCertificateRef" + + // This reason is used with the "ResolvedRefs" condition when an invalid or + // unsupported Route kind is specified by the Listener. + ListenerReasonInvalidRouteKinds ListenerConditionReason = "InvalidRouteKinds" + + // This reason is used with the "ResolvedRefs" condition when the + // Listener has a TLS configuration that references an object in another + // namespace, where the object in the other namespace does not have a + // ReferenceGrant explicitly allowing the reference. + ListenerReasonRefNotPermitted ListenerConditionReason = "RefNotPermitted" +) + +const ( + // This condition indicates whether a Listener has generated some + // configuration that will soon be ready in the underlying data plane. + // + // It is a positive-polarity summary condition, and so should always be + // present on the resource with ObservedGeneration set. + // + // It should be set to Unknown if the controller performs updates to the + // status before it has all the information it needs to be able to determine + // if the condition is true. + // + // Possible reasons for this condition to be True are: + // + // * "Programmed" + // + // Possible reasons for this condition to be False are: + // + // * "Invalid" + // * "Pending" + // + // Possible reasons for this condition to be Unknown are: + // + // * "Pending" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + ListenerConditionProgrammed ListenerConditionType = "Programmed" + + // This reason is used with the "Programmed" condition when the condition is + // true. + ListenerReasonProgrammed ListenerConditionReason = "Programmed" + + // This reason is used with the "Ready" and "Programmed" conditions when the + // Listener is syntactically or semantically invalid. + ListenerReasonInvalid ListenerConditionReason = "Invalid" + + // This reason is used with the "Accepted", "Ready" and "Programmed" + // conditions when the Listener is either not yet reconciled or not yet not + // online and ready to accept client traffic. + ListenerReasonPending ListenerConditionReason = "Pending" +) + +const ( + // "Ready" is a condition type reserved for future use. It should not be used by implementations. + // Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters + // to alert about usage. + // + // If used in the future, "Ready" will represent the final state where all configuration is confirmed good + // _and has completely propagated to the data plane_. That is, it is a _guarantee_ that, as soon as something + // sees the Condition as `true`, then connections will be correctly routed _immediately_. + // + // This is a very strong guarantee, and to date no implementation has satisfied it enough to implement it. + // This reservation can be discussed in the future if necessary. + // + // Deprecated: Ready is reserved for future use + ListenerConditionReady ListenerConditionType = "Ready" + + // Deprecated: Ready is reserved for future use + ListenerReasonReady ListenerConditionReason = "Ready" +) diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/gatewayclass_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/gatewayclass_types.go new file mode 100644 index 000000000..becbc14b2 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/gatewayclass_types.go @@ -0,0 +1,270 @@ +/* +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName` +// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +kubebuilder:printcolumn:name="Description",type=string,JSONPath=`.spec.description`,priority=1 + +// GatewayClass describes a class of Gateways available to the user for creating +// Gateway resources. +// +// It is recommended that this resource be used as a template for Gateways. This +// means that a Gateway is based on the state of the GatewayClass at the time it +// was created and changes to the GatewayClass or associated parameters are not +// propagated down to existing Gateways. This recommendation is intended to +// limit the blast radius of changes to GatewayClass or associated parameters. +// If implementations choose to propagate GatewayClass changes to existing +// Gateways, that MUST be clearly documented by the implementation. +// +// Whenever one or more Gateways are using a GatewayClass, implementations SHOULD +// add the `gateway-exists-finalizer.gateway.networking.k8s.io` finalizer on the +// associated GatewayClass. This ensures that a GatewayClass associated with a +// Gateway is not deleted while in use. +// +// GatewayClass is a Cluster level resource. +type GatewayClass struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of GatewayClass. + Spec GatewayClassSpec `json:"spec"` + + // Status defines the current state of GatewayClass. + // + // Implementations MUST populate status on all GatewayClass resources which + // specify their controller name. + // + // +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}} + Status GatewayClassStatus `json:"status,omitempty"` +} + +const ( + // GatewayClassFinalizerGatewaysExist should be added as a finalizer to the + // GatewayClass whenever there are provisioned Gateways using a + // GatewayClass. + GatewayClassFinalizerGatewaysExist = "gateway-exists-finalizer.gateway.networking.k8s.io" +) + +// GatewayClassSpec reflects the configuration of a class of Gateways. +type GatewayClassSpec struct { + // ControllerName is the name of the controller that is managing Gateways of + // this class. The value of this field MUST be a domain prefixed path. + // + // Example: "example.net/gateway-controller". + // + // This field is not mutable and cannot be empty. + // + // Support: Core + // + // +kubebuilder:validation:XValidation:message="Value is immutable",rule="self == oldSelf" + ControllerName GatewayController `json:"controllerName"` + + // ParametersRef is a reference to a resource that contains the configuration + // parameters corresponding to the GatewayClass. This is optional if the + // controller does not require any additional configuration. + // + // ParametersRef can reference a standard Kubernetes resource, i.e. ConfigMap, + // or an implementation-specific custom resource. The resource can be + // cluster-scoped or namespace-scoped. + // + // If the referent cannot be found, the GatewayClass's "InvalidParameters" + // status condition will be true. + // + // Support: Implementation-specific + // + // +optional + ParametersRef *ParametersReference `json:"parametersRef,omitempty"` + + // Description helps describe a GatewayClass with more details. + // + // +kubebuilder:validation:MaxLength=64 + // +optional + Description *string `json:"description,omitempty"` +} + +// ParametersReference identifies an API object containing controller-specific +// configuration resource within the cluster. +type ParametersReference struct { + // Group is the group of the referent. + Group Group `json:"group"` + + // Kind is kind of the referent. + Kind Kind `json:"kind"` + + // Name is the name of the referent. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + Name string `json:"name"` + + // Namespace is the namespace of the referent. + // This field is required when referring to a Namespace-scoped resource and + // MUST be unset when referring to a Cluster-scoped resource. + // + // +optional + Namespace *Namespace `json:"namespace,omitempty"` +} + +// GatewayClassConditionType is the type for status conditions on +// Gateway resources. This type should be used with the +// GatewayClassStatus.Conditions field. +type GatewayClassConditionType string + +// GatewayClassConditionReason defines the set of reasons that explain why a +// particular GatewayClass condition type has been raised. +type GatewayClassConditionReason string + +const ( + // This condition indicates whether the GatewayClass has been accepted by + // the controller requested in the `spec.controller` field. + // + // This condition defaults to Unknown, and MUST be set by a controller when + // it sees a GatewayClass using its controller string. The status of this + // condition MUST be set to True if the controller will support provisioning + // Gateways using this class. Otherwise, this status MUST be set to False. + // If the status is set to False, the controller SHOULD set a Message and + // Reason as an explanation. + // + // Possible reasons for this condition to be true are: + // + // * "Accepted" + // + // Possible reasons for this condition to be False are: + // + // * "InvalidParameters" + // * "UnsupportedVersion" + // + // Possible reasons for this condition to be Unknown are: + // + // * "Pending" + // + // Controllers should prefer to use the values of GatewayClassConditionReason + // for the corresponding Reason, where appropriate. + GatewayClassConditionStatusAccepted GatewayClassConditionType = "Accepted" + + // This reason is used with the "Accepted" condition when the condition is + // true. + GatewayClassReasonAccepted GatewayClassConditionReason = "Accepted" + + // This reason is used with the "Accepted" condition when the + // GatewayClass was not accepted because the parametersRef field + // was invalid, with more detail in the message. + GatewayClassReasonInvalidParameters GatewayClassConditionReason = "InvalidParameters" + + // This reason is used with the "Accepted" condition when the + // requested controller has not yet made a decision about whether + // to admit the GatewayClass. It is the default Reason on a new + // GatewayClass. + GatewayClassReasonPending GatewayClassConditionReason = "Pending" + + // Deprecated: Use "Pending" instead. + GatewayClassReasonWaiting GatewayClassConditionReason = "Waiting" +) + +const ( + // This condition indicates whether the GatewayClass supports the version(s) + // of Gateway API CRDs present in the cluster. This condition MUST be set by + // a controller when it marks a GatewayClass "Accepted". + // + // The version of a Gateway API CRD is defined by the + // gateway.networking.k8s.io/bundle-version annotation on the CRD. If + // implementations detect any Gateway API CRDs that either do not have this + // annotation set, or have it set to a version that is not recognized or + // supported by the implementation, this condition MUST be set to false. + // + // Implementations MAY choose to either provide "best effort" support when + // an unrecognized CRD version is present. This would be communicated by + // setting the "Accepted" condition to true and the "SupportedVersion" + // condition to false. + // + // Alternatively, implementations MAY choose not to support CRDs with + // unrecognized versions. This would be communicated by setting the + // "Accepted" condition to false with the reason "UnsupportedVersions". + // + // Possible reasons for this condition to be true are: + // + // * "SupportedVersion" + // + // Possible reasons for this condition to be False are: + // + // * "UnsupportedVersion" + // + // Controllers should prefer to use the values of GatewayClassConditionReason + // for the corresponding Reason, where appropriate. + // + // + GatewayClassConditionStatusSupportedVersion GatewayClassConditionType = "SupportedVersion" + + // This reason is used with the "SupportedVersion" condition when the + // condition is true. + GatewayClassReasonSupportedVersion GatewayClassConditionReason = "SupportedVersion" + + // This reason is used with the "SupportedVersion" or "Accepted" condition + // when the condition is false. A message SHOULD be included in this + // condition that includes the detected CRD version(s) present in the + // cluster and the CRD version(s) that are supported by the GatewayClass. + GatewayClassReasonUnsupportedVersion GatewayClassConditionReason = "UnsupportedVersion" +) + +// GatewayClassStatus is the current status for the GatewayClass. +type GatewayClassStatus struct { + // Conditions is the current status from the controller for + // this GatewayClass. + // + // Controllers should prefer to publish conditions using values + // of GatewayClassConditionType for the type of each Condition. + // + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=8 + // +kubebuilder:default={{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Pending", lastTransitionTime: "1970-01-01T00:00:00Z"}} + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // SupportedFeatures is the set of features the GatewayClass support. + // It MUST be sorted in ascending alphabetical order. + // +optional + // +listType=set + // + // +kubebuilder:validation:MaxItems=64 + SupportedFeatures []SupportedFeature `json:"supportedFeatures,omitempty"` +} + +// +kubebuilder:object:root=true + +// GatewayClassList contains a list of GatewayClass +type GatewayClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GatewayClass `json:"items"` +} + +// SupportedFeature is used to describe distinct features that are covered by +// conformance tests. +// +kubebuilder:validation:Enum=Gateway;GatewayPort8080;GatewayStaticAddresses;HTTPRoute;HTTPRouteDestinationPortMatching;HTTPRouteHostRewrite;HTTPRouteMethodMatching;HTTPRoutePathRedirect;HTTPRoutePathRewrite;HTTPRoutePortRedirect;HTTPRouteQueryParamMatching;HTTPRouteRequestMirror;HTTPRouteRequestMultipleMirrors;HTTPRouteResponseHeaderModification;HTTPRouteSchemeRedirect;Mesh;ReferenceGrant;TLSRoute +type SupportedFeature string diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/httproute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/httproute_types.go new file mode 100644 index 000000000..816551edf --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/httproute_types.go @@ -0,0 +1,1201 @@ +/* +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories=gateway-api +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames` +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` + +// HTTPRoute provides a way to route HTTP requests. This includes the capability +// to match requests by hostname, path, header, or query param. Filters can be +// used to specify additional processing steps. Backends specify where matching +// requests should be routed. +type HTTPRoute struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of HTTPRoute. + Spec HTTPRouteSpec `json:"spec"` + + // Status defines the current state of HTTPRoute. + Status HTTPRouteStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// HTTPRouteList contains a list of HTTPRoute. +type HTTPRouteList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HTTPRoute `json:"items"` +} + +// HTTPRouteSpec defines the desired state of HTTPRoute +type HTTPRouteSpec struct { + CommonRouteSpec `json:",inline"` + + // Hostnames defines a set of hostnames that should match against the HTTP Host + // header to select a HTTPRoute used to process the request. Implementations + // MUST ignore any port value specified in the HTTP Host header while + // performing a match and (absent of any applicable header modification + // configuration) MUST forward this header unmodified to the backend. + // + // Valid values for Hostnames are determined by RFC 1123 definition of a + // hostname with 2 notable exceptions: + // + // 1. IPs are not allowed. + // 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard + // label must appear by itself as the first label. + // + // If a hostname is specified by both the Listener and HTTPRoute, there + // must be at least one intersecting hostname for the HTTPRoute to be + // attached to the Listener. For example: + // + // * A Listener with `test.example.com` as the hostname matches HTTPRoutes + // that have either not specified any hostnames, or have specified at + // least one of `test.example.com` or `*.example.com`. + // * A Listener with `*.example.com` as the hostname matches HTTPRoutes + // that have either not specified any hostnames or have specified at least + // one hostname that matches the Listener hostname. For example, + // `*.example.com`, `test.example.com`, and `foo.test.example.com` would + // all match. On the other hand, `example.com` and `test.example.net` would + // not match. + // + // Hostnames that are prefixed with a wildcard label (`*.`) are interpreted + // as a suffix match. That means that a match for `*.example.com` would match + // both `test.example.com`, and `foo.test.example.com`, but not `example.com`. + // + // If both the Listener and HTTPRoute have specified hostnames, any + // HTTPRoute hostnames that do not match the Listener hostname MUST be + // ignored. For example, if a Listener specified `*.example.com`, and the + // HTTPRoute specified `test.example.com` and `test.example.net`, + // `test.example.net` must not be considered for a match. + // + // If both the Listener and HTTPRoute have specified hostnames, and none + // match with the criteria above, then the HTTPRoute is not accepted. The + // implementation must raise an 'Accepted' Condition with a status of + // `False` in the corresponding RouteParentStatus. + // + // In the event that multiple HTTPRoutes specify intersecting hostnames (e.g. + // overlapping wildcard matching and exact matching hostnames), precedence must + // be given to rules from the HTTPRoute with the largest number of: + // + // * Characters in a matching non-wildcard hostname. + // * Characters in a matching hostname. + // + // If ties exist across multiple Routes, the matching precedence rules for + // HTTPRouteMatches takes over. + // + // Support: Core + // + // +optional + // +kubebuilder:validation:MaxItems=16 + Hostnames []Hostname `json:"hostnames,omitempty"` + + // Rules are a list of HTTP matchers, filters and actions. + // + // +optional + // +kubebuilder:validation:MaxItems=16 + // +kubebuilder:default={{matches: {{path: {type: "PathPrefix", value: "/"}}}}} + Rules []HTTPRouteRule `json:"rules,omitempty"` +} + +// HTTPRouteRule defines semantics for matching an HTTP request based on +// conditions (matches), processing it (filters), and forwarding the request to +// an API object (backendRefs). +// +// +kubebuilder:validation:XValidation:message="RequestRedirect filter must not be used together with backendRefs",rule="(has(self.backendRefs) && size(self.backendRefs) > 0) ? (!has(self.filters) || self.filters.all(f, !has(f.requestRedirect))): true" +// +kubebuilder:validation:XValidation:message="When using RequestRedirect filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.filters) && self.filters.exists_one(f, has(f.requestRedirect) && has(f.requestRedirect.path) && f.requestRedirect.path.type == 'ReplacePrefixMatch' && has(f.requestRedirect.path.replacePrefixMatch))) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" +// +kubebuilder:validation:XValidation:message="When using URLRewrite filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.filters) && self.filters.exists_one(f, has(f.urlRewrite) && has(f.urlRewrite.path) && f.urlRewrite.path.type == 'ReplacePrefixMatch' && has(f.urlRewrite.path.replacePrefixMatch))) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" +// +kubebuilder:validation:XValidation:message="Within backendRefs, when using RequestRedirect filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.requestRedirect) && has(f.requestRedirect.path) && f.requestRedirect.path.type == 'ReplacePrefixMatch' && has(f.requestRedirect.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" +// +kubebuilder:validation:XValidation:message="Within backendRefs, When using URLRewrite filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.urlRewrite) && has(f.urlRewrite.path) && f.urlRewrite.path.type == 'ReplacePrefixMatch' && has(f.urlRewrite.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" +type HTTPRouteRule struct { + // Matches define conditions used for matching the rule against incoming + // HTTP requests. Each match is independent, i.e. this rule will be matched + // if **any** one of the matches is satisfied. + // + // For example, take the following matches configuration: + // + // ``` + // matches: + // - path: + // value: "/foo" + // headers: + // - name: "version" + // value: "v2" + // - path: + // value: "/v2/foo" + // ``` + // + // For a request to match against this rule, a request must satisfy + // EITHER of the two conditions: + // + // - path prefixed with `/foo` AND contains the header `version: v2` + // - path prefix of `/v2/foo` + // + // See the documentation for HTTPRouteMatch on how to specify multiple + // match conditions that should be ANDed together. + // + // If no matches are specified, the default is a prefix + // path match on "/", which has the effect of matching every + // HTTP request. + // + // Proxy or Load Balancer routing configuration generated from HTTPRoutes + // MUST prioritize matches based on the following criteria, continuing on + // ties. Across all rules specified on applicable Routes, precedence must be + // given to the match having: + // + // * "Exact" path match. + // * "Prefix" path match with largest number of characters. + // * Method match. + // * Largest number of header matches. + // * Largest number of query param matches. + // + // Note: The precedence of RegularExpression path matches are implementation-specific. + // + // If ties still exist across multiple Routes, matching precedence MUST be + // determined in order of the following criteria, continuing on ties: + // + // * The oldest Route based on creation timestamp. + // * The Route appearing first in alphabetical order by + // "{namespace}/{name}". + // + // If ties still exist within an HTTPRoute, matching precedence MUST be granted + // to the FIRST matching rule (in list order) with a match meeting the above + // criteria. + // + // When no rules matching a request have been successfully attached to the + // parent a request is coming from, a HTTP 404 status code MUST be returned. + // + // +optional + // +kubebuilder:validation:MaxItems=8 + // +kubebuilder:default={{path:{ type: "PathPrefix", value: "/"}}} + Matches []HTTPRouteMatch `json:"matches,omitempty"` + + // Filters define the filters that are applied to requests that match + // this rule. + // + // The effects of ordering of multiple behaviors are currently unspecified. + // This can change in the future based on feedback during the alpha stage. + // + // Conformance-levels at this level are defined based on the type of filter: + // + // - ALL core filters MUST be supported by all implementations. + // - Implementers are encouraged to support extended filters. + // - Implementation-specific custom filters have no API guarantees across + // implementations. + // + // Specifying the same filter multiple times is not supported unless explicitly + // indicated in the filter. + // + // All filters are expected to be compatible with each other except for the + // URLRewrite and RequestRedirect filters, which may not be combined. If an + // implementation can not support other combinations of filters, they must clearly + // document that limitation. In cases where incompatible or unsupported + // filters are specified and cause the `Accepted` condition to be set to status + // `False`, implementations may use the `IncompatibleFilters` reason to specify + // this configuration error. + // + // Support: Core + // + // +optional + // +kubebuilder:validation:MaxItems=16 + // +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))" + // +kubebuilder:validation:XValidation:message="RequestHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'RequestHeaderModifier').size() <= 1" + // +kubebuilder:validation:XValidation:message="ResponseHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'ResponseHeaderModifier').size() <= 1" + // +kubebuilder:validation:XValidation:message="RequestRedirect filter cannot be repeated",rule="self.filter(f, f.type == 'RequestRedirect').size() <= 1" + // +kubebuilder:validation:XValidation:message="URLRewrite filter cannot be repeated",rule="self.filter(f, f.type == 'URLRewrite').size() <= 1" + Filters []HTTPRouteFilter `json:"filters,omitempty"` + + // BackendRefs defines the backend(s) where matching requests should be + // sent. + // + // Failure behavior here depends on how many BackendRefs are specified and + // how many are invalid. + // + // If *all* entries in BackendRefs are invalid, and there are also no filters + // specified in this route rule, *all* traffic which matches this rule MUST + // receive a 500 status code. + // + // See the HTTPBackendRef definition for the rules about what makes a single + // HTTPBackendRef invalid. + // + // When a HTTPBackendRef is invalid, 500 status codes MUST be returned for + // requests that would have otherwise been routed to an invalid backend. If + // multiple backends are specified, and some are invalid, the proportion of + // requests that would otherwise have been routed to an invalid backend + // MUST receive a 500 status code. + // + // For example, if two backends are specified with equal weights, and one is + // invalid, 50 percent of traffic must receive a 500. Implementations may + // choose how that 50 percent is determined. + // + // Support: Core for Kubernetes Service + // + // Support: Extended for Kubernetes ServiceImport + // + // Support: Implementation-specific for any other resource + // + // Support for weight: Core + // + // +optional + // +kubebuilder:validation:MaxItems=16 + BackendRefs []HTTPBackendRef `json:"backendRefs,omitempty"` + + // Timeouts defines the timeouts that can be configured for an HTTP request. + // + // Support: Extended + // + // +optional + // + Timeouts *HTTPRouteTimeouts `json:"timeouts,omitempty"` +} + +// HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute. +// Timeout values are represented with Gateway API Duration formatting. +// Specifying a zero value such as "0s" is interpreted as no timeout. +// +// +kubebuilder:validation:XValidation:message="backendRequest timeout cannot be longer than request timeout",rule="!(has(self.request) && has(self.backendRequest) && duration(self.request) != duration('0s') && duration(self.backendRequest) > duration(self.request))" +type HTTPRouteTimeouts struct { + // Request specifies the maximum duration for a gateway to respond to an HTTP request. + // If the gateway has not been able to respond before this deadline is met, the gateway + // MUST return a timeout error. + // + // For example, setting the `rules.timeouts.request` field to the value `10s` in an + // `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds + // to complete. + // + // This timeout is intended to cover as close to the whole request-response transaction + // as possible although an implementation MAY choose to start the timeout after the entire + // request stream has been received instead of immediately after the transaction is + // initiated by the client. + // + // When this field is unspecified, request timeout behavior is implementation-specific. + // + // Support: Extended + // + // +optional + Request *Duration `json:"request,omitempty"` + + // BackendRequest specifies a timeout for an individual request from the gateway + // to a backend. This covers the time from when the request first starts being + // sent from the gateway to when the full response has been received from the backend. + // + // An entire client HTTP transaction with a gateway, covered by the Request timeout, + // may result in more than one call from the gateway to the destination backend, + // for example, if automatic retries are supported. + // + // Because the Request timeout encompasses the BackendRequest timeout, the value of + // BackendRequest must be <= the value of Request timeout. + // + // Support: Extended + // + // +optional + BackendRequest *Duration `json:"backendRequest,omitempty"` +} + +// PathMatchType specifies the semantics of how HTTP paths should be compared. +// Valid PathMatchType values, along with their support levels, are: +// +// * "Exact" - Core +// * "PathPrefix" - Core +// * "RegularExpression" - Implementation Specific +// +// PathPrefix and Exact paths must be syntactically valid: +// +// - Must begin with the `/` character +// - Must not contain consecutive `/` characters (e.g. `/foo///`, `//`). +// +// Note that values may be added to this enum, implementations +// must ensure that unknown values will not cause a crash. +// +// Unknown values here must result in the implementation setting the +// Accepted Condition for the Route to `status: False`, with a +// Reason of `UnsupportedValue`. +// +// +kubebuilder:validation:Enum=Exact;PathPrefix;RegularExpression +type PathMatchType string + +const ( + // Matches the URL path exactly and with case sensitivity. This means that + // an exact path match on `/abc` will only match requests to `/abc`, NOT + // `/abc/`, `/Abc`, or `/abcd`. + PathMatchExact PathMatchType = "Exact" + + // 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. When specified, a trailing `/` is ignored. + // + // For example, the paths `/abc`, `/abc/`, and `/abc/def` would all match + // the prefix `/abc`, but the path `/abcd` would not. + // + // "PathPrefix" is semantically equivalent to the "Prefix" path type in the + // Kubernetes Ingress API. + PathMatchPathPrefix PathMatchType = "PathPrefix" + + // Matches if the URL path matches the given regular expression with + // case sensitivity. + // + // Since `"RegularExpression"` has implementation-specific conformance, + // implementations can support POSIX, PCRE, RE2 or any other regular expression + // dialect. + // Please read the implementation's documentation to determine the supported + // dialect. + PathMatchRegularExpression PathMatchType = "RegularExpression" +) + +// HTTPPathMatch describes how to select a HTTP route by matching the HTTP request path. +// +// +kubebuilder:validation:XValidation:message="value must be an absolute path and start with '/' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? self.value.startsWith('/') : true" +// +kubebuilder:validation:XValidation:message="must not contain '//' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('//') : true" +// +kubebuilder:validation:XValidation:message="must not contain '/./' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('/./') : true" +// +kubebuilder:validation:XValidation:message="must not contain '/../' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('/../') : true" +// +kubebuilder:validation:XValidation:message="must not contain '%2f' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('%2f') : true" +// +kubebuilder:validation:XValidation:message="must not contain '%2F' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('%2F') : true" +// +kubebuilder:validation:XValidation:message="must not contain '#' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('#') : true" +// +kubebuilder:validation:XValidation:message="must not end with '/..' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.endsWith('/..') : true" +// +kubebuilder:validation:XValidation:message="must not end with '/.' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.endsWith('/.') : true" +// +kubebuilder:validation:XValidation:message="type must be one of ['Exact', 'PathPrefix', 'RegularExpression']",rule="self.type in ['Exact','PathPrefix'] || self.type == 'RegularExpression'" +// +kubebuilder:validation:XValidation:message="must only contain valid characters (matching ^(?:[-A-Za-z0-9/._~!$&'()*+,;=:@]|[%][0-9a-fA-F]{2})+$) for types ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? self.value.matches(r\"\"\"^(?:[-A-Za-z0-9/._~!$&'()*+,;=:@]|[%][0-9a-fA-F]{2})+$\"\"\") : true" +type HTTPPathMatch struct { + // Type specifies how to match against the path Value. + // + // Support: Core (Exact, PathPrefix) + // + // Support: Implementation-specific (RegularExpression) + // + // +optional + // +kubebuilder:default=PathPrefix + Type *PathMatchType `json:"type,omitempty"` + + // Value of the HTTP path to match against. + // + // +optional + // +kubebuilder:default="/" + // +kubebuilder:validation:MaxLength=1024 + Value *string `json:"value,omitempty"` +} + +// HeaderMatchType specifies the semantics of how HTTP header values should be +// compared. Valid HeaderMatchType values, along with their conformance levels, are: +// +// * "Exact" - Core +// * "RegularExpression" - Implementation Specific +// +// Note that values may be added to this enum, implementations +// must ensure that unknown values will not cause a crash. +// +// Unknown values here must result in the implementation setting the +// Accepted Condition for the Route to `status: False`, with a +// Reason of `UnsupportedValue`. +// +// +kubebuilder:validation:Enum=Exact;RegularExpression +type HeaderMatchType string + +// HeaderMatchType constants. +const ( + HeaderMatchExact HeaderMatchType = "Exact" + HeaderMatchRegularExpression HeaderMatchType = "RegularExpression" +) + +// HTTPHeaderName is the name of an HTTP header. +// +// Valid values include: +// +// * "Authorization" +// * "Set-Cookie" +// +// Invalid values include: +// +// - ":method" - ":" is an invalid character. This means that HTTP/2 pseudo +// headers are not currently supported by this type. +// - "/invalid" - "/ " is an invalid character +type HTTPHeaderName HeaderName + +// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request +// headers. +type HTTPHeaderMatch struct { + // Type specifies how to match against the value of the header. + // + // Support: Core (Exact) + // + // Support: Implementation-specific (RegularExpression) + // + // Since RegularExpression HeaderMatchType has implementation-specific + // conformance, implementations can support POSIX, PCRE or any other dialects + // of regular expressions. Please read the implementation's documentation to + // determine the supported dialect. + // + // +optional + // +kubebuilder:default=Exact + Type *HeaderMatchType `json:"type,omitempty"` + + // Name is the name of the HTTP Header to be matched. Name matching MUST be + // case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + // + // If multiple entries specify equivalent header names, only the first + // entry with an equivalent name MUST be considered for a match. Subsequent + // entries with an equivalent header name MUST be ignored. Due to the + // case-insensitivity of header names, "foo" and "Foo" are considered + // equivalent. + // + // When a header is repeated in an HTTP request, it is + // implementation-specific behavior as to how this is represented. + // Generally, proxies should follow the guidance from the RFC: + // https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding + // processing a repeated header, with special handling for "Set-Cookie". + Name HTTPHeaderName `json:"name"` + + // Value is the value of HTTP Header to be matched. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=4096 + Value string `json:"value"` +} + +// QueryParamMatchType specifies the semantics of how HTTP query parameter +// values should be compared. Valid QueryParamMatchType values, along with their +// conformance levels, are: +// +// * "Exact" - Core +// * "RegularExpression" - Implementation Specific +// +// Note that values may be added to this enum, implementations +// must ensure that unknown values will not cause a crash. +// +// Unknown values here must result in the implementation setting the +// Accepted Condition for the Route to `status: False`, with a +// Reason of `UnsupportedValue`. +// +// +kubebuilder:validation:Enum=Exact;RegularExpression +type QueryParamMatchType string + +// QueryParamMatchType constants. +const ( + QueryParamMatchExact QueryParamMatchType = "Exact" + QueryParamMatchRegularExpression QueryParamMatchType = "RegularExpression" +) + +// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP +// query parameters. +type HTTPQueryParamMatch struct { + // Type specifies how to match against the value of the query parameter. + // + // Support: Extended (Exact) + // + // Support: Implementation-specific (RegularExpression) + // + // Since RegularExpression QueryParamMatchType has Implementation-specific + // conformance, implementations can support POSIX, PCRE or any other + // dialects of regular expressions. Please read the implementation's + // documentation to determine the supported dialect. + // + // +optional + // +kubebuilder:default=Exact + Type *QueryParamMatchType `json:"type,omitempty"` + + // Name is the name of the HTTP query param to be matched. This must be an + // exact string match. (See + // https://tools.ietf.org/html/rfc7230#section-2.7.3). + // + // If multiple entries specify equivalent query param names, only the first + // entry with an equivalent name MUST be considered for a match. Subsequent + // entries with an equivalent query param name MUST be ignored. + // + // If a query param is repeated in an HTTP request, the behavior is + // purposely left undefined, since different data planes have different + // capabilities. However, it is *recommended* that implementations should + // match against the first value of the param if the data plane supports it, + // as this behavior is expected in other load balancing contexts outside of + // the Gateway API. + // + // Users SHOULD NOT route traffic based on repeated query params to guard + // themselves against potential differences in the implementations. + Name HTTPHeaderName `json:"name"` + + // Value is the value of HTTP query param to be matched. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=1024 + Value string `json:"value"` +} + +// HTTPMethod describes how to select a HTTP route by matching the HTTP +// method as defined by +// [RFC 7231](https://datatracker.ietf.org/doc/html/rfc7231#section-4) and +// [RFC 5789](https://datatracker.ietf.org/doc/html/rfc5789#section-2). +// The value is expected in upper case. +// +// Note that values may be added to this enum, implementations +// must ensure that unknown values will not cause a crash. +// +// Unknown values here must result in the implementation setting the +// Accepted Condition for the Route to `status: False`, with a +// Reason of `UnsupportedValue`. +// +// +kubebuilder:validation:Enum=GET;HEAD;POST;PUT;DELETE;CONNECT;OPTIONS;TRACE;PATCH +type HTTPMethod string + +const ( + HTTPMethodGet HTTPMethod = "GET" + HTTPMethodHead HTTPMethod = "HEAD" + HTTPMethodPost HTTPMethod = "POST" + HTTPMethodPut HTTPMethod = "PUT" + HTTPMethodDelete HTTPMethod = "DELETE" + HTTPMethodConnect HTTPMethod = "CONNECT" + HTTPMethodOptions HTTPMethod = "OPTIONS" + HTTPMethodTrace HTTPMethod = "TRACE" + HTTPMethodPatch HTTPMethod = "PATCH" +) + +// HTTPRouteMatch defines the predicate used to match requests to a given +// action. Multiple match types are ANDed together, i.e. the match will +// evaluate to true only if all conditions are satisfied. +// +// For example, the match below will match a HTTP request only if its path +// starts with `/foo` AND it contains the `version: v1` header: +// +// ``` +// match: +// +// path: +// value: "/foo" +// headers: +// - name: "version" +// value "v1" +// +// ``` +type HTTPRouteMatch struct { + // Path specifies a HTTP request path matcher. If this field is not + // specified, a default prefix match on the "/" path is provided. + // + // +optional + // +kubebuilder:default={type: "PathPrefix", value: "/"} + Path *HTTPPathMatch `json:"path,omitempty"` + + // Headers specifies HTTP request header matchers. Multiple match values are + // ANDed together, meaning, a request must match all the specified headers + // to select the route. + // + // +listType=map + // +listMapKey=name + // +optional + // +kubebuilder:validation:MaxItems=16 + Headers []HTTPHeaderMatch `json:"headers,omitempty"` + + // QueryParams specifies HTTP query parameter matchers. Multiple match + // values are ANDed together, meaning, a request must match all the + // specified query parameters to select the route. + // + // Support: Extended + // + // +listType=map + // +listMapKey=name + // +optional + // +kubebuilder:validation:MaxItems=16 + QueryParams []HTTPQueryParamMatch `json:"queryParams,omitempty"` + + // Method specifies HTTP method matcher. + // When specified, this route will be matched only if the request has the + // specified method. + // + // Support: Extended + // + // +optional + Method *HTTPMethod `json:"method,omitempty"` +} + +// HTTPRouteFilter defines processing steps that must be completed during the +// request or response lifecycle. HTTPRouteFilters are meant as an extension +// point to express processing that may be done in Gateway implementations. Some +// examples include request or response modification, implementing +// authentication strategies, rate-limiting, and traffic shaping. API +// guarantee/conformance is defined based on the type of the filter. +// +// +kubebuilder:validation:XValidation:message="filter.requestHeaderModifier must be nil if the filter.type is not RequestHeaderModifier",rule="!(has(self.requestHeaderModifier) && self.type != 'RequestHeaderModifier')" +// +kubebuilder:validation:XValidation:message="filter.requestHeaderModifier must be specified for RequestHeaderModifier filter.type",rule="!(!has(self.requestHeaderModifier) && self.type == 'RequestHeaderModifier')" +// +kubebuilder:validation:XValidation:message="filter.responseHeaderModifier must be nil if the filter.type is not ResponseHeaderModifier",rule="!(has(self.responseHeaderModifier) && self.type != 'ResponseHeaderModifier')" +// +kubebuilder:validation:XValidation:message="filter.responseHeaderModifier must be specified for ResponseHeaderModifier filter.type",rule="!(!has(self.responseHeaderModifier) && self.type == 'ResponseHeaderModifier')" +// +kubebuilder:validation:XValidation:message="filter.requestMirror must be nil if the filter.type is not RequestMirror",rule="!(has(self.requestMirror) && self.type != 'RequestMirror')" +// +kubebuilder:validation:XValidation:message="filter.requestMirror must be specified for RequestMirror filter.type",rule="!(!has(self.requestMirror) && self.type == 'RequestMirror')" +// +kubebuilder:validation:XValidation:message="filter.requestRedirect must be nil if the filter.type is not RequestRedirect",rule="!(has(self.requestRedirect) && self.type != 'RequestRedirect')" +// +kubebuilder:validation:XValidation:message="filter.requestRedirect must be specified for RequestRedirect filter.type",rule="!(!has(self.requestRedirect) && self.type == 'RequestRedirect')" +// +kubebuilder:validation:XValidation:message="filter.urlRewrite must be nil if the filter.type is not URLRewrite",rule="!(has(self.urlRewrite) && self.type != 'URLRewrite')" +// +kubebuilder:validation:XValidation:message="filter.urlRewrite must be specified for URLRewrite filter.type",rule="!(!has(self.urlRewrite) && self.type == 'URLRewrite')" +// +kubebuilder:validation:XValidation:message="filter.extensionRef must be nil if the filter.type is not ExtensionRef",rule="!(has(self.extensionRef) && self.type != 'ExtensionRef')" +// +kubebuilder:validation:XValidation:message="filter.extensionRef must be specified for ExtensionRef filter.type",rule="!(!has(self.extensionRef) && self.type == 'ExtensionRef')" +type HTTPRouteFilter struct { + // Type identifies the type of filter to apply. As with other API fields, + // types are classified into three conformance levels: + // + // - Core: Filter types and their corresponding configuration defined by + // "Support: Core" in this package, e.g. "RequestHeaderModifier". All + // implementations must support core filters. + // + // - Extended: Filter types and their corresponding configuration defined by + // "Support: Extended" in this package, e.g. "RequestMirror". Implementers + // are encouraged to support extended filters. + // + // - Implementation-specific: Filters that are defined and supported by + // specific vendors. + // In the future, filters showing convergence in behavior across multiple + // implementations will be considered for inclusion in extended or core + // conformance levels. Filter-specific configuration for such filters + // is specified using the ExtensionRef field. `Type` should be set to + // "ExtensionRef" for custom filters. + // + // Implementers are encouraged to define custom implementation types to + // extend the core API with implementation-specific behavior. + // + // If a reference to a custom filter type cannot be resolved, the filter + // MUST NOT be skipped. Instead, requests that would have been processed by + // that filter MUST receive a HTTP error response. + // + // Note that values may be added to this enum, implementations + // must ensure that unknown values will not cause a crash. + // + // Unknown values here must result in the implementation setting the + // Accepted Condition for the Route to `status: False`, with a + // Reason of `UnsupportedValue`. + // + // +unionDiscriminator + // +kubebuilder:validation:Enum=RequestHeaderModifier;ResponseHeaderModifier;RequestMirror;RequestRedirect;URLRewrite;ExtensionRef + Type HTTPRouteFilterType `json:"type"` + + // RequestHeaderModifier defines a schema for a filter that modifies request + // headers. + // + // Support: Core + // + // +optional + RequestHeaderModifier *HTTPHeaderFilter `json:"requestHeaderModifier,omitempty"` + + // ResponseHeaderModifier defines a schema for a filter that modifies response + // headers. + // + // Support: Extended + // + // +optional + ResponseHeaderModifier *HTTPHeaderFilter `json:"responseHeaderModifier,omitempty"` + + // RequestMirror defines a schema for a filter that mirrors requests. + // Requests are sent to the specified destination, but responses from + // that destination are ignored. + // + // This filter can be used multiple times within the same rule. Note that + // not all implementations will be able to support mirroring to multiple + // backends. + // + // Support: Extended + // + // +optional + RequestMirror *HTTPRequestMirrorFilter `json:"requestMirror,omitempty"` + + // RequestRedirect defines a schema for a filter that responds to the + // request with an HTTP redirection. + // + // Support: Core + // + // +optional + RequestRedirect *HTTPRequestRedirectFilter `json:"requestRedirect,omitempty"` + + // URLRewrite defines a schema for a filter that modifies a request during forwarding. + // + // Support: Extended + // + // +optional + URLRewrite *HTTPURLRewriteFilter `json:"urlRewrite,omitempty"` + + // ExtensionRef is an optional, implementation-specific extension to the + // "filter" behavior. For example, resource "myroutefilter" in group + // "networking.example.net"). ExtensionRef MUST NOT be used for core and + // extended filters. + // + // This filter can be used multiple times within the same rule. + // + // Support: Implementation-specific + // + // +optional + ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` +} + +// HTTPRouteFilterType identifies a type of HTTPRoute filter. +type HTTPRouteFilterType string + +const ( + // HTTPRouteFilterRequestHeaderModifier can be used to add or remove an HTTP + // header from an HTTP request before it is sent to the upstream target. + // + // Support in HTTPRouteRule: Core + // + // Support in HTTPBackendRef: Extended + HTTPRouteFilterRequestHeaderModifier HTTPRouteFilterType = "RequestHeaderModifier" + + // HTTPRouteFilterResponseHeaderModifier can be used to add or remove an HTTP + // header from an HTTP response before it is sent to the client. + // + // Support in HTTPRouteRule: Extended + // + // Support in HTTPBackendRef: Extended + HTTPRouteFilterResponseHeaderModifier HTTPRouteFilterType = "ResponseHeaderModifier" + + // HTTPRouteFilterRequestRedirect can be used to redirect a request to + // another location. This filter can also be used for HTTP to HTTPS + // redirects. This may not be used on the same Route rule or BackendRef as a + // URLRewrite filter. + // + // Support in HTTPRouteRule: Core + // + // Support in HTTPBackendRef: Extended + HTTPRouteFilterRequestRedirect HTTPRouteFilterType = "RequestRedirect" + + // HTTPRouteFilterURLRewrite can be used to modify a request during + // forwarding. At most one of these filters may be used on a Route rule. + // This may not be used on the same Route rule or BackendRef as a + // RequestRedirect filter. + // + // Support in HTTPRouteRule: Extended + // + // Support in HTTPBackendRef: Extended + HTTPRouteFilterURLRewrite HTTPRouteFilterType = "URLRewrite" + + // HTTPRouteFilterRequestMirror can be used to mirror HTTP requests to a + // different backend. The responses from this backend MUST be ignored by + // the Gateway. + // + // Support in HTTPRouteRule: Extended + // + // Support in HTTPBackendRef: Extended + HTTPRouteFilterRequestMirror HTTPRouteFilterType = "RequestMirror" + + // HTTPRouteFilterExtensionRef should be used for configuring custom + // HTTP filters. + // + // Support in HTTPRouteRule: Implementation-specific + // + // Support in HTTPBackendRef: Implementation-specific + HTTPRouteFilterExtensionRef HTTPRouteFilterType = "ExtensionRef" +) + +// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230. +type HTTPHeader struct { + // Name is the name of the HTTP Header to be matched. Name matching MUST be + // case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). + // + // If multiple entries specify equivalent header names, the first entry with + // an equivalent name MUST be considered for a match. Subsequent entries + // with an equivalent header name MUST be ignored. Due to the + // case-insensitivity of header names, "foo" and "Foo" are considered + // equivalent. + Name HTTPHeaderName `json:"name"` + + // Value is the value of HTTP Header to be matched. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=4096 + Value string `json:"value"` +} + +// HTTPHeaderFilter defines a filter that modifies the headers of an HTTP +// request or response. Only one action for a given header name is permitted. +// Filters specifying multiple actions of the same or different type for any one +// header name are invalid and will be rejected by the webhook if installed. +// Configuration to set or add multiple values for a header must use RFC 7230 +// header value formatting, separating each value with a comma. +type HTTPHeaderFilter struct { + // Set overwrites the request with the given header (name, value) + // before the action. + // + // Input: + // GET /foo HTTP/1.1 + // my-header: foo + // + // Config: + // set: + // - name: "my-header" + // value: "bar" + // + // Output: + // GET /foo HTTP/1.1 + // my-header: bar + // + // +optional + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=16 + Set []HTTPHeader `json:"set,omitempty"` + + // Add adds the given header(s) (name, value) to the request + // before the action. It appends to any existing values associated + // with the header name. + // + // Input: + // GET /foo HTTP/1.1 + // my-header: foo + // + // Config: + // add: + // - name: "my-header" + // value: "bar,baz" + // + // Output: + // GET /foo HTTP/1.1 + // my-header: foo,bar,baz + // + // +optional + // +listType=map + // +listMapKey=name + // +kubebuilder:validation:MaxItems=16 + Add []HTTPHeader `json:"add,omitempty"` + + // Remove the given header(s) from the HTTP request before the action. The + // value of Remove is a list of HTTP header names. Note that the header + // names are case-insensitive (see + // https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). + // + // Input: + // GET /foo HTTP/1.1 + // my-header1: foo + // my-header2: bar + // my-header3: baz + // + // Config: + // remove: ["my-header1", "my-header3"] + // + // Output: + // GET /foo HTTP/1.1 + // my-header2: bar + // + // +optional + // +listType=set + // +kubebuilder:validation:MaxItems=16 + Remove []string `json:"remove,omitempty"` +} + +// HTTPPathModifierType defines the type of path redirect or rewrite. +type HTTPPathModifierType string + +const ( + // This type of modifier indicates that the full path will be replaced + // by the specified value. + FullPathHTTPPathModifier HTTPPathModifierType = "ReplaceFullPath" + + // This type of modifier indicates that any prefix path matches will be + // replaced by the substitution value. For example, a path with a prefix + // match of "/foo" and a ReplacePrefixMatch substitution of "/bar" will have + // the "/foo" prefix replaced with "/bar" in matching requests. + // + // Note that this matches the behavior of the PathPrefix match type. This + // matches full path elements. A path element refers to the list of labels + // in the path split by the `/` separator. When specified, a trailing `/` is + // ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all + // match the prefix `/abc`, but the path `/abcd` would not. + PrefixMatchHTTPPathModifier HTTPPathModifierType = "ReplacePrefixMatch" +) + +// HTTPPathModifier defines configuration for path modifiers. +// +// +kubebuilder:validation:XValidation:message="replaceFullPath must be specified when type is set to 'ReplaceFullPath'",rule="self.type == 'ReplaceFullPath' ? has(self.replaceFullPath) : true" +// +kubebuilder:validation:XValidation:message="type must be 'ReplaceFullPath' when replaceFullPath is set",rule="has(self.replaceFullPath) ? self.type == 'ReplaceFullPath' : true" +// +kubebuilder:validation:XValidation:message="replacePrefixMatch must be specified when type is set to 'ReplacePrefixMatch'",rule="self.type == 'ReplacePrefixMatch' ? has(self.replacePrefixMatch) : true" +// +kubebuilder:validation:XValidation:message="type must be 'ReplacePrefixMatch' when replacePrefixMatch is set",rule="has(self.replacePrefixMatch) ? self.type == 'ReplacePrefixMatch' : true" +type HTTPPathModifier struct { + // Type defines the type of path modifier. Additional types may be + // added in a future release of the API. + // + // Note that values may be added to this enum, implementations + // must ensure that unknown values will not cause a crash. + // + // Unknown values here must result in the implementation setting the + // Accepted Condition for the Route to `status: False`, with a + // Reason of `UnsupportedValue`. + // + // +kubebuilder:validation:Enum=ReplaceFullPath;ReplacePrefixMatch + Type HTTPPathModifierType `json:"type"` + + // ReplaceFullPath specifies the value with which to replace the full path + // of a request during a rewrite or redirect. + // + // +kubebuilder:validation:MaxLength=1024 + // +optional + ReplaceFullPath *string `json:"replaceFullPath,omitempty"` + + // ReplacePrefixMatch specifies the value with which to replace the prefix + // match of a request during a rewrite or redirect. For example, a request + // to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch + // of "/xyz" would be modified to "/xyz/bar". + // + // Note that this matches the behavior of the PathPrefix match type. This + // matches full path elements. A path element refers to the list of labels + // in the path split by the `/` separator. When specified, a trailing `/` is + // ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all + // match the prefix `/abc`, but the path `/abcd` would not. + // + // ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch. + // Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in + // the implementation setting the Accepted Condition for the Route to `status: False`. + // + // Request Path | Prefix Match | Replace Prefix | Modified Path + // -------------|--------------|----------------|---------- + // /foo/bar | /foo | /xyz | /xyz/bar + // /foo/bar | /foo | /xyz/ | /xyz/bar + // /foo/bar | /foo/ | /xyz | /xyz/bar + // /foo/bar | /foo/ | /xyz/ | /xyz/bar + // /foo | /foo | /xyz | /xyz + // /foo/ | /foo | /xyz | /xyz/ + // /foo/bar | /foo | | /bar + // /foo/ | /foo | | / + // /foo | /foo | | / + // /foo/ | /foo | / | / + // /foo | /foo | / | / + // + // +kubebuilder:validation:MaxLength=1024 + // +optional + ReplacePrefixMatch *string `json:"replacePrefixMatch,omitempty"` +} + +// HTTPRequestRedirect defines a filter that redirects a request. This filter +// MUST NOT be used on the same Route rule as a HTTPURLRewrite filter. +type HTTPRequestRedirectFilter struct { + // Scheme is the scheme to be used in the value of the `Location` header in + // the response. When empty, the scheme of the request is used. + // + // Scheme redirects can affect the port of the redirect, for more information, + // refer to the documentation for the port field of this filter. + // + // Note that values may be added to this enum, implementations + // must ensure that unknown values will not cause a crash. + // + // Unknown values here must result in the implementation setting the + // Accepted Condition for the Route to `status: False`, with a + // Reason of `UnsupportedValue`. + // + // Support: Extended + // + // +optional + // +kubebuilder:validation:Enum=http;https + Scheme *string `json:"scheme,omitempty"` + + // Hostname is the hostname to be used in the value of the `Location` + // header in the response. + // When empty, the hostname in the `Host` header of the request is used. + // + // Support: Core + // + // +optional + Hostname *PreciseHostname `json:"hostname,omitempty"` + + // Path defines parameters used to modify the path of the incoming request. + // The modified path is then used to construct the `Location` header. When + // empty, the request path is used as-is. + // + // Support: Extended + // + // +optional + Path *HTTPPathModifier `json:"path,omitempty"` + + // Port is the port to be used in the value of the `Location` + // header in the response. + // + // If no port is specified, the redirect port MUST be derived using the + // following rules: + // + // * If redirect scheme is not-empty, the redirect port MUST be the well-known + // port associated with the redirect scheme. Specifically "http" to port 80 + // and "https" to port 443. If the redirect scheme does not have a + // well-known port, the listener port of the Gateway SHOULD be used. + // * If redirect scheme is empty, the redirect port MUST be the Gateway + // Listener port. + // + // Implementations SHOULD NOT add the port number in the 'Location' + // header in the following cases: + // + // * A Location header that will use HTTP (whether that is determined via + // the Listener protocol or the Scheme field) _and_ use port 80. + // * A Location header that will use HTTPS (whether that is determined via + // the Listener protocol or the Scheme field) _and_ use port 443. + // + // Support: Extended + // + // +optional + Port *PortNumber `json:"port,omitempty"` + + // StatusCode is the HTTP status code to be used in response. + // + // Note that values may be added to this enum, implementations + // must ensure that unknown values will not cause a crash. + // + // Unknown values here must result in the implementation setting the + // Accepted Condition for the Route to `status: False`, with a + // Reason of `UnsupportedValue`. + // + // Support: Core + // + // +optional + // +kubebuilder:default=302 + // +kubebuilder:validation:Enum=301;302 + StatusCode *int `json:"statusCode,omitempty"` +} + +// HTTPURLRewriteFilter defines a filter that modifies a request during +// forwarding. At most one of these filters may be used on a Route rule. This +// MUST NOT be used on the same Route rule as a HTTPRequestRedirect filter. +// +// Support: Extended +type HTTPURLRewriteFilter struct { + // Hostname is the value to be used to replace the Host header value during + // forwarding. + // + // Support: Extended + // + // +optional + Hostname *PreciseHostname `json:"hostname,omitempty"` + + // Path defines a path rewrite. + // + // Support: Extended + // + // +optional + Path *HTTPPathModifier `json:"path,omitempty"` +} + +// HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. +type HTTPRequestMirrorFilter struct { + // BackendRef references a resource where mirrored requests are sent. + // + // Mirrored requests must be sent only to a single destination endpoint + // within this BackendRef, irrespective of how many endpoints are present + // within this BackendRef. + // + // If the referent cannot be found, this BackendRef is invalid and must be + // dropped from the Gateway. The controller must ensure the "ResolvedRefs" + // condition on the Route status is set to `status: False` and not configure + // this backend in the underlying implementation. + // + // If there is a cross-namespace reference to an *existing* object + // that is not allowed by a ReferenceGrant, the controller must ensure the + // "ResolvedRefs" condition on the Route is set to `status: False`, + // with the "RefNotPermitted" reason and not configure this backend in the + // underlying implementation. + // + // In either error case, the Message of the `ResolvedRefs` Condition + // should be used to provide more detail about the problem. + // + // Support: Extended for Kubernetes Service + // + // Support: Implementation-specific for any other resource + BackendRef BackendObjectReference `json:"backendRef"` +} + +// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request. +// +// Note that when a namespace different than the local namespace is specified, a +// ReferenceGrant object is required in the referent namespace to allow that +// namespace's owner to accept the reference. See the ReferenceGrant +// documentation for details. +// +// +// +// When the BackendRef points to a Kubernetes Service, implementations SHOULD +// honor the appProtocol field if it is set for the target Service Port. +// +// Implementations supporting appProtocol SHOULD recognize the Kubernetes +// Standard Application Protocols defined in KEP-3726. +// +// If a Service appProtocol isn't specified, an implementation MAY infer the +// backend protocol through its own means. Implementations MAY infer the +// protocol from the Route type referring to the backend Service. +// +// If a Route is not able to send traffic to the backend using the specified +// protocol then the backend is considered invalid. Implementations MUST set the +// "ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason. +// +// +type HTTPBackendRef struct { + // BackendRef is a reference to a backend to forward matched requests to. + // + // A BackendRef can be invalid for the following reasons. In all cases, the + // implementation MUST ensure the `ResolvedRefs` Condition on the Route + // is set to `status: False`, with a Reason and Message that indicate + // what is the cause of the error. + // + // A BackendRef is invalid if: + // + // * It refers to an unknown or unsupported kind of resource. In this + // case, the Reason must be set to `InvalidKind` and Message of the + // Condition must explain which kind of resource is unknown or unsupported. + // + // * It refers to a resource that does not exist. In this case, the Reason must + // be set to `BackendNotFound` and the Message of the Condition must explain + // which resource does not exist. + // + // * It refers a resource in another namespace when the reference has not been + // explicitly allowed by a ReferenceGrant (or equivalent concept). In this + // case, the Reason must be set to `RefNotPermitted` and the Message of the + // Condition must explain which cross-namespace reference is not allowed. + // + // * It refers to a Kubernetes Service that has an incompatible appProtocol + // for the given Route type + // + // * The BackendTLSPolicy object is installed in the cluster, a BackendTLSPolicy + // is present that refers to the Service, and the implementation is unable + // to meet the requirement. At the time of writing, BackendTLSPolicy is + // experimental, but once it becomes standard, this will become a MUST + // requirement. + // + // Support: Core for Kubernetes Service + // + // Support: Implementation-specific for any other resource + // + // Support for weight: Core + // + // Support for Kubernetes Service appProtocol: Extended + // + // Support for BackendTLSPolicy: Experimental and ImplementationSpecific + // + // +optional + BackendRef `json:",inline"` + + // Filters defined at this level should be executed if and only if the + // request is being forwarded to the backend defined here. + // + // Support: Implementation-specific (For broader support of filters, use the + // Filters field in HTTPRouteRule.) + // + // +optional + // +kubebuilder:validation:MaxItems=16 + // +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))" + // +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))" + // +kubebuilder:validation:XValidation:message="RequestHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'RequestHeaderModifier').size() <= 1" + // +kubebuilder:validation:XValidation:message="ResponseHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'ResponseHeaderModifier').size() <= 1" + // +kubebuilder:validation:XValidation:message="RequestRedirect filter cannot be repeated",rule="self.filter(f, f.type == 'RequestRedirect').size() <= 1" + // +kubebuilder:validation:XValidation:message="URLRewrite filter cannot be repeated",rule="self.filter(f, f.type == 'URLRewrite').size() <= 1" + Filters []HTTPRouteFilter `json:"filters,omitempty"` +} + +// HTTPRouteStatus defines the observed state of HTTPRoute. +type HTTPRouteStatus struct { + RouteStatus `json:",inline"` +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/object_reference_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/object_reference_types.go new file mode 100644 index 000000000..c9a58b15f --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/object_reference_types.go @@ -0,0 +1,147 @@ +/* +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 v1 + +// LocalObjectReference identifies an API object within the namespace of the +// referrer. +// The API object must be valid in the cluster; the Group and Kind must +// be registered in the cluster for this reference to be valid. +// +// References to objects with invalid Group and Kind are not valid, and must +// be rejected by the implementation, with appropriate Conditions set +// on the containing object. +type LocalObjectReference struct { + // Group is the group of the referent. For example, "gateway.networking.k8s.io". + // When unspecified or empty string, core API group is inferred. + Group Group `json:"group"` + + // Kind is kind of the referent. For example "HTTPRoute" or "Service". + Kind Kind `json:"kind"` + + // Name is the name of the referent. + Name ObjectName `json:"name"` +} + +// SecretObjectReference identifies an API object including its namespace, +// defaulting to Secret. +// +// The API object must be valid in the cluster; the Group and Kind must +// be registered in the cluster for this reference to be valid. +// +// References to objects with invalid Group and Kind are not valid, and must +// be rejected by the implementation, with appropriate Conditions set +// on the containing object. +type SecretObjectReference struct { + // Group is the group of the referent. For example, "gateway.networking.k8s.io". + // When unspecified or empty string, core API group is inferred. + // + // +optional + // +kubebuilder:default="" + Group *Group `json:"group"` + + // Kind is kind of the referent. For example "Secret". + // + // +optional + // +kubebuilder:default=Secret + Kind *Kind `json:"kind"` + + // Name is the name of the referent. + Name ObjectName `json:"name"` + + // Namespace is the namespace of the referenced object. When unspecified, the local + // namespace is inferred. + // + // Note that when a namespace different than the local namespace is specified, + // a ReferenceGrant object is required in the referent namespace to allow that + // namespace's owner to accept the reference. See the ReferenceGrant + // documentation for details. + // + // Support: Core + // + // +optional + Namespace *Namespace `json:"namespace,omitempty"` +} + +// BackendObjectReference defines how an ObjectReference that is +// specific to BackendRef. It includes a few additional fields and features +// than a regular ObjectReference. +// +// Note that when a namespace different than the local namespace is specified, a +// ReferenceGrant object is required in the referent namespace to allow that +// namespace's owner to accept the reference. See the ReferenceGrant +// documentation for details. +// +// The API object must be valid in the cluster; the Group and Kind must +// be registered in the cluster for this reference to be valid. +// +// References to objects with invalid Group and Kind are not valid, and must +// be rejected by the implementation, with appropriate Conditions set +// on the containing object. +// +// +kubebuilder:validation:XValidation:message="Must have port for Service reference",rule="(size(self.group) == 0 && self.kind == 'Service') ? has(self.port) : true" +type BackendObjectReference struct { + // Group is the group of the referent. For example, "gateway.networking.k8s.io". + // When unspecified or empty string, core API group is inferred. + // + // +optional + // +kubebuilder:default="" + Group *Group `json:"group,omitempty"` + + // Kind is the Kubernetes resource kind of the referent. For example + // "Service". + // + // Defaults to "Service" when not specified. + // + // ExternalName services can refer to CNAME DNS records that may live + // outside of the cluster and as such are difficult to reason about in + // terms of conformance. They also may not be safe to forward to (see + // CVE-2021-25740 for more information). Implementations SHOULD NOT + // support ExternalName Services. + // + // Support: Core (Services with a type other than ExternalName) + // + // Support: Implementation-specific (Services with type ExternalName) + // + // +optional + // +kubebuilder:default=Service + Kind *Kind `json:"kind,omitempty"` + + // Name is the name of the referent. + Name ObjectName `json:"name"` + + // Namespace is the namespace of the backend. When unspecified, the local + // namespace is inferred. + // + // Note that when a namespace different than the local namespace is specified, + // a ReferenceGrant object is required in the referent namespace to allow that + // namespace's owner to accept the reference. See the ReferenceGrant + // documentation for details. + // + // Support: Core + // + // +optional + Namespace *Namespace `json:"namespace,omitempty"` + + // Port specifies the destination port number to use for this resource. + // Port is required when the referent is a Kubernetes Service. In this + // case, the port number is the service port number, not the target port. + // For other resources, destination port might be derived from the referent + // resource or this field. + // + // +optional + Port *PortNumber `json:"port,omitempty"` +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/shared_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/shared_types.go new file mode 100644 index 000000000..21de37b5d --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/shared_types.go @@ -0,0 +1,738 @@ +/* +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ParentReference identifies an API object (usually a Gateway) that can be considered +// a parent of this resource (usually a route). There are two kinds of parent resources +// with "Core" support: +// +// * Gateway (Gateway conformance profile) +// * Service (Mesh conformance profile, experimental, ClusterIP Services only) +// +// This API may be extended in the future to support additional kinds of parent +// resources. +// +// The API object must be valid in the cluster; the Group and Kind must +// be registered in the cluster for this reference to be valid. +type ParentReference struct { + // Group is the group of the referent. + // When unspecified, "gateway.networking.k8s.io" is inferred. + // To set the core API group (such as for a "Service" kind referent), + // Group must be explicitly set to "" (empty string). + // + // Support: Core + // + // +kubebuilder:default=gateway.networking.k8s.io + // +optional + Group *Group `json:"group,omitempty"` + + // Kind is kind of the referent. + // + // There are two kinds of parent resources with "Core" support: + // + // * Gateway (Gateway conformance profile) + // * Service (Mesh conformance profile, experimental, ClusterIP Services only) + // + // Support for other resources is Implementation-Specific. + // + // +kubebuilder:default=Gateway + // +optional + Kind *Kind `json:"kind,omitempty"` + + // Namespace is the namespace of the referent. When unspecified, this refers + // to the local namespace of the Route. + // + // Note that there are specific rules for ParentRefs which cross namespace + // boundaries. Cross-namespace references are only valid if they are explicitly + // allowed by something in the namespace they are referring to. For example: + // Gateway has the AllowedRoutes field, and ReferenceGrant provides a + // generic way to enable any other kind of cross-namespace reference. + // + // + // ParentRefs from a Route to a Service in the same namespace are "producer" + // routes, which apply default routing rules to inbound connections from + // any namespace to the Service. + // + // ParentRefs from a Route to a Service in a different namespace are + // "consumer" routes, and these routing rules are only applied to outbound + // connections originating from the same namespace as the Route, for which + // the intended destination of the connections are a Service targeted as a + // ParentRef of the Route. + // + // + // Support: Core + // + // +optional + Namespace *Namespace `json:"namespace,omitempty"` + + // Name is the name of the referent. + // + // Support: Core + Name ObjectName `json:"name"` + + // SectionName is the name of a section within the target resource. In the + // following resources, SectionName is interpreted as the following: + // + // * Gateway: Listener Name. When both Port (experimental) and SectionName + // are specified, the name and port of the selected listener must match + // both specified values. + // * Service: Port Name. When both Port (experimental) and SectionName + // are specified, the name and port of the selected listener must match + // both specified values. Note that attaching Routes to Services as Parents + // is part of experimental Mesh support and is not supported for any other + // purpose. + // + // Implementations MAY choose to support attaching Routes to other resources. + // If that is the case, they MUST clearly document how SectionName is + // interpreted. + // + // When unspecified (empty string), this will reference the entire resource. + // For the purpose of status, an attachment is considered successful if at + // least one section in the parent resource accepts it. For example, Gateway + // listeners can restrict which Routes can attach to them by Route kind, + // namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from + // the referencing Route, the Route MUST be considered successfully + // attached. If no Gateway listeners accept attachment from this Route, the + // Route MUST be considered detached from the Gateway. + // + // Support: Core + // + // +optional + SectionName *SectionName `json:"sectionName,omitempty"` + + // Port is the network port this Route targets. It can be interpreted + // differently based on the type of parent resource. + // + // When the parent resource is a Gateway, this targets all listeners + // listening on the specified port that also support this kind of Route(and + // select this Route). It's not recommended to set `Port` unless the + // networking behaviors specified in a Route must apply to a specific port + // as opposed to a listener(s) whose port(s) may be changed. When both Port + // and SectionName are specified, the name and port of the selected listener + // must match both specified values. + // + // + // When the parent resource is a Service, this targets a specific port in the + // Service spec. When both Port (experimental) and SectionName are specified, + // the name and port of the selected port must match both specified values. + // + // + // Implementations MAY choose to support other parent resources. + // Implementations supporting other types of parent resources MUST clearly + // document how/if Port is interpreted. + // + // For the purpose of status, an attachment is considered successful as + // long as the parent resource accepts it partially. For example, Gateway + // listeners can restrict which Routes can attach to them by Route kind, + // namespace, or hostname. If 1 of 2 Gateway listeners accept attachment + // from the referencing Route, the Route MUST be considered successfully + // attached. If no Gateway listeners accept attachment from this Route, + // the Route MUST be considered detached from the Gateway. + // + // Support: Extended + // + // +optional + // + Port *PortNumber `json:"port,omitempty"` +} + +// CommonRouteSpec defines the common attributes that all Routes MUST include +// within their spec. +type CommonRouteSpec struct { + // ParentRefs references the resources (usually Gateways) that a Route wants + // to be attached to. Note that the referenced parent resource needs to + // allow this for the attachment to be complete. For Gateways, that means + // the Gateway needs to allow attachment from Routes of this kind and + // namespace. For Services, that means the Service must either be in the same + // namespace for a "producer" route, or the mesh implementation must support + // and allow "consumer" routes for the referenced Service. ReferenceGrant is + // not applicable for governing ParentRefs to Services - it is not possible to + // create a "producer" route for a Service in a different namespace from the + // Route. + // + // There are two kinds of parent resources with "Core" support: + // + // * Gateway (Gateway conformance profile) + // + // * Service (Mesh conformance profile, experimental, ClusterIP Services only) + // + // This API may be extended in the future to support additional kinds of parent + // resources. + // + // ParentRefs must be _distinct_. This means either that: + // + // * They select different objects. If this is the case, then parentRef + // entries are distinct. In terms of fields, this means that the + // multi-part key defined by `group`, `kind`, `namespace`, and `name` must + // be unique across all parentRef entries in the Route. + // * They do not select different objects, but for each optional field used, + // each ParentRef that selects the same object must set the same set of + // optional fields to different values. If one ParentRef sets a + // combination of optional fields, all must set the same combination. + // + // Some examples: + // + // * If one ParentRef sets `sectionName`, all ParentRefs referencing the + // same object must also set `sectionName`. + // * If one ParentRef sets `port`, all ParentRefs referencing the same + // object must also set `port`. + // * If one ParentRef sets `sectionName` and `port`, all ParentRefs + // referencing the same object must also set `sectionName` and `port`. + // + // It is possible to separately reference multiple distinct objects that may + // be collapsed by an implementation. For example, some implementations may + // choose to merge compatible Gateway Listeners together. If that is the + // case, the list of routes attached to those resources should also be + // merged. + // + // Note that for ParentRefs that cross namespace boundaries, there are specific + // rules. Cross-namespace references are only valid if they are explicitly + // allowed by something in the namespace they are referring to. For example, + // Gateway has the AllowedRoutes field, and ReferenceGrant provides a + // generic way to enable other kinds of cross-namespace reference. + // + // + // ParentRefs from a Route to a Service in the same namespace are "producer" + // routes, which apply default routing rules to inbound connections from + // any namespace to the Service. + // + // ParentRefs from a Route to a Service in a different namespace are + // "consumer" routes, and these routing rules are only applied to outbound + // connections originating from the same namespace as the Route, for which + // the intended destination of the connections are a Service targeted as a + // ParentRef of the Route. + // + // + // +optional + // +kubebuilder:validation:MaxItems=32 + // + // + // + // + ParentRefs []ParentReference `json:"parentRefs,omitempty"` +} + +// PortNumber defines a network port. +// +// +kubebuilder:validation:Minimum=1 +// +kubebuilder:validation:Maximum=65535 +type PortNumber int32 + +// BackendRef defines how a Route should forward a request to a Kubernetes +// resource. +// +// Note that when a namespace different than the local namespace is specified, a +// ReferenceGrant object is required in the referent namespace to allow that +// namespace's owner to accept the reference. See the ReferenceGrant +// documentation for details. +// +// +// +// When the BackendRef points to a Kubernetes Service, implementations SHOULD +// honor the appProtocol field if it is set for the target Service Port. +// +// Implementations supporting appProtocol SHOULD recognize the Kubernetes +// Standard Application Protocols defined in KEP-3726. +// +// If a Service appProtocol isn't specified, an implementation MAY infer the +// backend protocol through its own means. Implementations MAY infer the +// protocol from the Route type referring to the backend Service. +// +// If a Route is not able to send traffic to the backend using the specified +// protocol then the backend is considered invalid. Implementations MUST set the +// "ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason. +// +// +// +// Note that when the BackendTLSPolicy object is enabled by the implementation, +// there are some extra rules about validity to consider here. See the fields +// where this struct is used for more information about the exact behavior. +type BackendRef struct { + // BackendObjectReference references a Kubernetes object. + BackendObjectReference `json:",inline"` + + // Weight specifies the proportion of requests forwarded to the referenced + // backend. This is computed as weight/(sum of all weights in this + // BackendRefs list). For non-zero values, there may be some epsilon from + // the exact proportion defined here depending on the precision an + // implementation supports. Weight is not a percentage and the sum of + // weights does not need to equal 100. + // + // If only one backend is specified and it has a weight greater than 0, 100% + // of the traffic is forwarded to that backend. If weight is set to 0, no + // traffic should be forwarded for this entry. If unspecified, weight + // defaults to 1. + // + // Support for this field varies based on the context where used. + // + // +optional + // +kubebuilder:default=1 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=1000000 + Weight *int32 `json:"weight,omitempty"` +} + +// RouteConditionType is a type of condition for a route. +type RouteConditionType string + +// RouteConditionReason is a reason for a route condition. +type RouteConditionReason string + +const ( + // This condition indicates whether the route has been accepted or rejected + // by a Gateway, and why. + // + // Possible reasons for this condition to be True are: + // + // * "Accepted" + // + // Possible reasons for this condition to be False are: + // + // * "NotAllowedByListeners" + // * "NoMatchingListenerHostname" + // * "NoMatchingParent" + // * "UnsupportedValue" + // + // Possible reasons for this condition to be Unknown are: + // + // * "Pending" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + RouteConditionAccepted RouteConditionType = "Accepted" + + // This reason is used with the "Accepted" condition when the Route has been + // accepted by the Gateway. + RouteReasonAccepted RouteConditionReason = "Accepted" + + // This reason is used with the "Accepted" condition when the route has not + // been accepted by a Gateway because the Gateway has no Listener whose + // allowedRoutes criteria permit the route + RouteReasonNotAllowedByListeners RouteConditionReason = "NotAllowedByListeners" + + // This reason is used with the "Accepted" condition when the Gateway has no + // compatible Listeners whose Hostname matches the route + RouteReasonNoMatchingListenerHostname RouteConditionReason = "NoMatchingListenerHostname" + + // This reason is used with the "Accepted" condition when there are + // no matching Parents. In the case of Gateways, this can occur when + // a Route ParentRef specifies a Port and/or SectionName that does not + // match any Listeners in the Gateway. + RouteReasonNoMatchingParent RouteConditionReason = "NoMatchingParent" + + // This reason is used with the "Accepted" condition when a value for an Enum + // is not recognized. + RouteReasonUnsupportedValue RouteConditionReason = "UnsupportedValue" + + // This reason is used with the "Accepted" when a controller has not yet + // reconciled the route. + RouteReasonPending RouteConditionReason = "Pending" + + // This reason is used with the "Accepted" condition when there + // are incompatible filters present on a route rule (for example if + // the URLRewrite and RequestRedirect are both present on an HTTPRoute). + RouteReasonIncompatibleFilters RouteConditionReason = "IncompatibleFilters" +) + +const ( + // This condition indicates whether the controller was able to resolve all + // the object references for the Route. + // + // Possible reasons for this condition to be True are: + // + // * "ResolvedRefs" + // + // Possible reasons for this condition to be False are: + // + // * "RefNotPermitted" + // * "InvalidKind" + // * "BackendNotFound" + // * "UnsupportedProtocol" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. + RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs" + + // This reason is used with the "ResolvedRefs" condition when the condition + // is true. + RouteReasonResolvedRefs RouteConditionReason = "ResolvedRefs" + + // This reason is used with the "ResolvedRefs" condition when + // one of the Listener's Routes has a BackendRef to an object in + // another namespace, where the object in the other namespace does + // not have a ReferenceGrant explicitly allowing the reference. + RouteReasonRefNotPermitted RouteConditionReason = "RefNotPermitted" + + // This reason is used with the "ResolvedRefs" condition when + // one of the Route's rules has a reference to an unknown or unsupported + // Group and/or Kind. + RouteReasonInvalidKind RouteConditionReason = "InvalidKind" + + // This reason is used with the "ResolvedRefs" condition when one of the + // Route's rules has a reference to a resource that does not exist. + RouteReasonBackendNotFound RouteConditionReason = "BackendNotFound" + + // This reason is used with the "ResolvedRefs" condition when one of the + // Route's rules has a reference to a resource with an app protocol that + // is not supported by this implementation. + RouteReasonUnsupportedProtocol RouteConditionReason = "UnsupportedProtocol" +) + +const ( + // This condition indicates that the Route contains a combination of both + // valid and invalid rules. + // + // When this happens, implementations MUST take one of the following + // approaches: + // + // 1) Drop Rule(s): With this approach, implementations will drop the + // invalid Route Rule(s) until they are fully valid again. The message + // for this condition MUST start with the prefix "Dropped Rule" and + // include information about which Rules have been dropped. In this + // state, the "Accepted" condition MUST be set to "True" with the latest + // generation of the resource. + // 2) Fall Back: With this approach, implementations will fall back to the + // last known good state of the entire Route. The message for this + // condition MUST start with the prefix "Fall Back" and include + // information about why the current Rule(s) are invalid. To represent + // this, the "Accepted" condition MUST be set to "True" with the + // generation of the last known good state of the resource. + // + // Reverting to the last known good state should only be done by + // implementations that have a means of restoring that state if/when they + // are restarted. + // + // This condition MUST NOT be set if a Route is fully valid, fully invalid, + // or not accepted. By extension, that means that this condition MUST only + // be set when it is "True". + // + // Possible reasons for this condition to be True are: + // + // * "UnsupportedValue" + // + // Controllers may raise this condition with other reasons, but should + // prefer to use the reasons listed above to improve interoperability. + RouteConditionPartiallyInvalid RouteConditionType = "PartiallyInvalid" +) + +// RouteParentStatus describes the status of a route with respect to an +// associated Parent. +type RouteParentStatus struct { + // ParentRef corresponds with a ParentRef in the spec that this + // RouteParentStatus struct describes the status of. + ParentRef ParentReference `json:"parentRef"` + + // ControllerName is a domain/path string that indicates the name of the + // controller that wrote this status. This corresponds with the + // controllerName field on GatewayClass. + // + // Example: "example.net/gateway-controller". + // + // The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are + // valid Kubernetes names + // (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). + // + // Controllers MUST populate this field when writing status. Controllers should ensure that + // entries to status populated with their ControllerName are cleaned up when they are no + // longer necessary. + ControllerName GatewayController `json:"controllerName"` + + // Conditions describes the status of the route with respect to the Gateway. + // Note that the route's availability is also subject to the Gateway's own + // status conditions and listener status. + // + // If the Route's ParentRef specifies an existing Gateway that supports + // Routes of this kind AND that Gateway's controller has sufficient access, + // then that Gateway's controller MUST set the "Accepted" condition on the + // Route, to indicate whether the route has been accepted or rejected by the + // Gateway, and why. + // + // A Route MUST be considered "Accepted" if at least one of the Route's + // rules is implemented by the Gateway. + // + // There are a number of cases where the "Accepted" condition may not be set + // due to lack of controller visibility, that includes when: + // + // * The Route refers to a non-existent parent. + // * The Route is of a type that the controller does not support. + // * The Route is in a namespace the controller does not have access to. + // + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=8 + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// RouteStatus defines the common attributes that all Routes MUST include within +// their status. +type RouteStatus struct { + // Parents is a list of parent resources (usually Gateways) that are + // associated with the route, and the status of the route with respect to + // each parent. When this route attaches to a parent, the controller that + // manages the parent must add an entry to this list when the controller + // first sees the route and should update the entry as appropriate when the + // route or gateway is modified. + // + // Note that parent references that cannot be resolved by an implementation + // of this API will not be added to this list. Implementations of this API + // can only populate Route status for the Gateways/parent resources they are + // responsible for. + // + // A maximum of 32 Gateways will be represented in this list. An empty list + // means the route has not been attached to any Gateway. + // + // +kubebuilder:validation:MaxItems=32 + Parents []RouteParentStatus `json:"parents"` +} + +// Hostname is the fully qualified domain name of a network host. This matches +// the RFC 1123 definition of a hostname with 2 notable exceptions: +// +// 1. IPs are not allowed. +// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard +// label must appear by itself as the first label. +// +// Hostname can be "precise" which is a domain name without the terminating +// dot of a network host (e.g. "foo.example.com") or "wildcard", which is a +// domain name prefixed with a single wildcard label (e.g. `*.example.com`). +// +// Note that as per RFC1035 and RFC1123, a *label* must consist of lower case +// alphanumeric characters or '-', and must start and end with an alphanumeric +// character. No other punctuation is allowed. +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` +type Hostname string + +// PreciseHostname is the fully qualified domain name of a network host. This +// matches the RFC 1123 definition of a hostname with 1 notable exception that +// numeric IP addresses are not allowed. +// +// Note that as per RFC1035 and RFC1123, a *label* must consist of lower case +// alphanumeric characters or '-', and must start and end with an alphanumeric +// character. No other punctuation is allowed. +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` +type PreciseHostname string + +// Group refers to a Kubernetes Group. It must either be an empty string or a +// RFC 1123 subdomain. +// +// This validation is based off of the corresponding Kubernetes validation: +// https://github.com/kubernetes/apimachinery/blob/02cfb53916346d085a6c6c7c66f882e3c6b0eca6/pkg/util/validation/validation.go#L208 +// +// Valid values include: +// +// * "" - empty string implies core Kubernetes API group +// * "gateway.networking.k8s.io" +// * "foo.example.com" +// +// Invalid values include: +// +// * "example.com/bar" - "/" is an invalid character +// +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` +type Group string + +// Kind refers to a Kubernetes Kind. +// +// Valid values include: +// +// * "Service" +// * "HTTPRoute" +// +// Invalid values include: +// +// * "invalid/kind" - "/" is an invalid character +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=63 +// +kubebuilder:validation:Pattern=`^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` +type Kind string + +// ObjectName refers to the name of a Kubernetes object. +// Object names can have a variety of forms, including RFC1123 subdomains, +// RFC 1123 labels, or RFC 1035 labels. +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +type ObjectName string + +// Namespace refers to a Kubernetes namespace. It must be a RFC 1123 label. +// +// This validation is based off of the corresponding Kubernetes validation: +// https://github.com/kubernetes/apimachinery/blob/02cfb53916346d085a6c6c7c66f882e3c6b0eca6/pkg/util/validation/validation.go#L187 +// +// This is used for Namespace name validation here: +// https://github.com/kubernetes/apimachinery/blob/02cfb53916346d085a6c6c7c66f882e3c6b0eca6/pkg/api/validation/generic.go#L63 +// +// Valid values include: +// +// * "example" +// +// Invalid values include: +// +// * "example.com" - "." is an invalid character +// +// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=63 +type Namespace string + +// SectionName is the name of a section in a Kubernetes resource. +// +// This validation is based off of the corresponding Kubernetes validation: +// https://github.com/kubernetes/apimachinery/blob/02cfb53916346d085a6c6c7c66f882e3c6b0eca6/pkg/util/validation/validation.go#L208 +// +// Valid values include: +// +// * "example.com" +// * "foo.example.com" +// +// Invalid values include: +// +// * "example.com/bar" - "/" is an invalid character +// +// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +type SectionName string + +// GatewayController is the name of a Gateway API controller. It must be a +// domain prefixed path. +// +// Valid values include: +// +// * "example.com/bar" +// +// Invalid values include: +// +// * "example.com" - must include path +// * "foo.example.com" - must include path +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` +type GatewayController string + +// AnnotationKey is the key of an annotation in Gateway API. This is used for +// validation of maps such as TLS options. This matches the Kubernetes +// "qualified name" validation that is used for annotations and other common +// values. +// +// Valid values include: +// +// * example +// * example.com +// * example.com/path +// * example.com/path.html +// +// Invalid values include: +// +// * example~ - "~" is an invalid character +// * example.com. - can not start or end with "." +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]/?)*$` +type AnnotationKey string + +// AnnotationValue is the value of an annotation in Gateway API. This is used +// for validation of maps such as TLS options. This roughly matches Kubernetes +// annotation validation, although the length validation in that case is based +// on the entire size of the annotations struct. +// +// +kubebuilder:validation:MinLength=0 +// +kubebuilder:validation:MaxLength=4096 +type AnnotationValue string + +// AddressType defines how a network address is represented as a text string. +// This may take two possible forms: +// +// * A predefined CamelCase string identifier (currently limited to `IPAddress` or `Hostname`) +// * A domain-prefixed string identifier (like `acme.io/CustomAddressType`) +// +// Values `IPAddress` and `Hostname` have Extended support. +// +// The `NamedAddress` value has been deprecated in favor of implementation +// specific domain-prefixed strings. +// +// All other values, including domain-prefixed values have Implementation-specific support, +// which are used in implementation-specific behaviors. Support for additional +// predefined CamelCase identifiers may be added in future releases. +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^Hostname|IPAddress|NamedAddress|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` +type AddressType string + +// HeaderName is the name of a header or query parameter. +// +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=256 +// +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$` +// +k8s:deepcopy-gen=false +type HeaderName string + +// Duration is a string value representing a duration in time. The format is as specified +// in GEP-2257, a strict subset of the syntax parsed by Golang time.ParseDuration. +// +// +kubebuilder:validation:Pattern=`^([0-9]{1,5}(h|m|s|ms)){1,4}$` +type Duration string + +const ( + // A textual representation of a numeric IP address. IPv4 + // addresses must be in dotted-decimal form. IPv6 addresses + // must be in a standard IPv6 text representation + // (see [RFC 5952](https://tools.ietf.org/html/rfc5952)). + // + // This type is intended for specific addresses. Address ranges are not + // supported (e.g. you can not use a CIDR range like 127.0.0.0/24 as an + // IPAddress). + // + // Support: Extended + IPAddressType AddressType = "IPAddress" + + // A Hostname represents a DNS based ingress point. This is similar to the + // corresponding hostname field in Kubernetes load balancer status. For + // example, this concept may be used for cloud load balancers where a DNS + // name is used to expose a load balancer. + // + // Support: Extended + HostnameAddressType AddressType = "Hostname" + + // A NamedAddress provides a way to reference a specific IP address by name. + // For example, this may be a name or other unique identifier that refers + // to a resource on a cloud provider such as a static IP. + // + // The `NamedAddress` type has been deprecated in favor of implementation + // specific domain-prefixed strings. + // + // Support: Implementation-specific + NamedAddressType AddressType = "NamedAddress" +) diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.deepcopy.go new file mode 100644 index 000000000..8d047a284 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.deepcopy.go @@ -0,0 +1,1220 @@ +//go:build !ignore_autogenerated + +/* +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 controller-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AllowedRoutes) DeepCopyInto(out *AllowedRoutes) { + *out = *in + if in.Namespaces != nil { + in, out := &in.Namespaces, &out.Namespaces + *out = new(RouteNamespaces) + (*in).DeepCopyInto(*out) + } + if in.Kinds != nil { + in, out := &in.Kinds, &out.Kinds + *out = make([]RouteGroupKind, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllowedRoutes. +func (in *AllowedRoutes) DeepCopy() *AllowedRoutes { + if in == nil { + return nil + } + out := new(AllowedRoutes) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendObjectReference) DeepCopyInto(out *BackendObjectReference) { + *out = *in + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) + **out = **in + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(Kind) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(PortNumber) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendObjectReference. +func (in *BackendObjectReference) DeepCopy() *BackendObjectReference { + if in == nil { + return nil + } + out := new(BackendObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendRef) DeepCopyInto(out *BackendRef) { + *out = *in + in.BackendObjectReference.DeepCopyInto(&out.BackendObjectReference) + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendRef. +func (in *BackendRef) DeepCopy() *BackendRef { + if in == nil { + return nil + } + out := new(BackendRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CommonRouteSpec) DeepCopyInto(out *CommonRouteSpec) { + *out = *in + if in.ParentRefs != nil { + in, out := &in.ParentRefs, &out.ParentRefs + *out = make([]ParentReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRouteSpec. +func (in *CommonRouteSpec) DeepCopy() *CommonRouteSpec { + if in == nil { + return nil + } + out := new(CommonRouteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Gateway) DeepCopyInto(out *Gateway) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gateway. +func (in *Gateway) DeepCopy() *Gateway { + if in == nil { + return nil + } + out := new(Gateway) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Gateway) 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 *GatewayAddress) DeepCopyInto(out *GatewayAddress) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(AddressType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayAddress. +func (in *GatewayAddress) DeepCopy() *GatewayAddress { + if in == nil { + return nil + } + out := new(GatewayAddress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayClass) DeepCopyInto(out *GatewayClass) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClass. +func (in *GatewayClass) DeepCopy() *GatewayClass { + if in == nil { + return nil + } + out := new(GatewayClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GatewayClass) 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 *GatewayClassList) DeepCopyInto(out *GatewayClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]GatewayClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClassList. +func (in *GatewayClassList) DeepCopy() *GatewayClassList { + if in == nil { + return nil + } + out := new(GatewayClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GatewayClassList) 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 *GatewayClassSpec) DeepCopyInto(out *GatewayClassSpec) { + *out = *in + if in.ParametersRef != nil { + in, out := &in.ParametersRef, &out.ParametersRef + *out = new(ParametersReference) + (*in).DeepCopyInto(*out) + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClassSpec. +func (in *GatewayClassSpec) DeepCopy() *GatewayClassSpec { + if in == nil { + return nil + } + out := new(GatewayClassSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayClassStatus) DeepCopyInto(out *GatewayClassStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SupportedFeatures != nil { + in, out := &in.SupportedFeatures, &out.SupportedFeatures + *out = make([]SupportedFeature, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClassStatus. +func (in *GatewayClassStatus) DeepCopy() *GatewayClassStatus { + if in == nil { + return nil + } + out := new(GatewayClassStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayInfrastructure) DeepCopyInto(out *GatewayInfrastructure) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[AnnotationKey]AnnotationValue, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[AnnotationKey]AnnotationValue, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayInfrastructure. +func (in *GatewayInfrastructure) DeepCopy() *GatewayInfrastructure { + if in == nil { + return nil + } + out := new(GatewayInfrastructure) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayList) DeepCopyInto(out *GatewayList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Gateway, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayList. +func (in *GatewayList) DeepCopy() *GatewayList { + if in == nil { + return nil + } + out := new(GatewayList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *GatewayList) 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 *GatewaySpec) DeepCopyInto(out *GatewaySpec) { + *out = *in + if in.Listeners != nil { + in, out := &in.Listeners, &out.Listeners + *out = make([]Listener, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]GatewayAddress, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Infrastructure != nil { + in, out := &in.Infrastructure, &out.Infrastructure + *out = new(GatewayInfrastructure) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec. +func (in *GatewaySpec) DeepCopy() *GatewaySpec { + if in == nil { + return nil + } + out := new(GatewaySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayStatus) DeepCopyInto(out *GatewayStatus) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]GatewayStatusAddress, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Listeners != nil { + in, out := &in.Listeners, &out.Listeners + *out = make([]ListenerStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayStatus. +func (in *GatewayStatus) DeepCopy() *GatewayStatus { + if in == nil { + return nil + } + out := new(GatewayStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayStatusAddress) DeepCopyInto(out *GatewayStatusAddress) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(AddressType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayStatusAddress. +func (in *GatewayStatusAddress) DeepCopy() *GatewayStatusAddress { + if in == nil { + return nil + } + out := new(GatewayStatusAddress) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayTLSConfig) DeepCopyInto(out *GatewayTLSConfig) { + *out = *in + if in.Mode != nil { + in, out := &in.Mode, &out.Mode + *out = new(TLSModeType) + **out = **in + } + if in.CertificateRefs != nil { + in, out := &in.CertificateRefs, &out.CertificateRefs + *out = make([]SecretObjectReference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make(map[AnnotationKey]AnnotationValue, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayTLSConfig. +func (in *GatewayTLSConfig) DeepCopy() *GatewayTLSConfig { + if in == nil { + return nil + } + out := new(GatewayTLSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPBackendRef) DeepCopyInto(out *HTTPBackendRef) { + *out = *in + in.BackendRef.DeepCopyInto(&out.BackendRef) + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]HTTPRouteFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPBackendRef. +func (in *HTTPBackendRef) DeepCopy() *HTTPBackendRef { + if in == nil { + return nil + } + out := new(HTTPBackendRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPHeader) DeepCopyInto(out *HTTPHeader) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeader. +func (in *HTTPHeader) DeepCopy() *HTTPHeader { + if in == nil { + return nil + } + out := new(HTTPHeader) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPHeaderFilter) DeepCopyInto(out *HTTPHeaderFilter) { + *out = *in + if in.Set != nil { + in, out := &in.Set, &out.Set + *out = make([]HTTPHeader, len(*in)) + copy(*out, *in) + } + if in.Add != nil { + in, out := &in.Add, &out.Add + *out = make([]HTTPHeader, len(*in)) + copy(*out, *in) + } + if in.Remove != nil { + in, out := &in.Remove, &out.Remove + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeaderFilter. +func (in *HTTPHeaderFilter) DeepCopy() *HTTPHeaderFilter { + if in == nil { + return nil + } + out := new(HTTPHeaderFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPHeaderMatch) DeepCopyInto(out *HTTPHeaderMatch) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(HeaderMatchType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeaderMatch. +func (in *HTTPHeaderMatch) DeepCopy() *HTTPHeaderMatch { + if in == nil { + return nil + } + out := new(HTTPHeaderMatch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPPathMatch) DeepCopyInto(out *HTTPPathMatch) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(PathMatchType) + **out = **in + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPathMatch. +func (in *HTTPPathMatch) DeepCopy() *HTTPPathMatch { + if in == nil { + return nil + } + out := new(HTTPPathMatch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPPathModifier) DeepCopyInto(out *HTTPPathModifier) { + *out = *in + if in.ReplaceFullPath != nil { + in, out := &in.ReplaceFullPath, &out.ReplaceFullPath + *out = new(string) + **out = **in + } + if in.ReplacePrefixMatch != nil { + in, out := &in.ReplacePrefixMatch, &out.ReplacePrefixMatch + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPathModifier. +func (in *HTTPPathModifier) DeepCopy() *HTTPPathModifier { + if in == nil { + return nil + } + out := new(HTTPPathModifier) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPQueryParamMatch) DeepCopyInto(out *HTTPQueryParamMatch) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(QueryParamMatchType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPQueryParamMatch. +func (in *HTTPQueryParamMatch) DeepCopy() *HTTPQueryParamMatch { + if in == nil { + return nil + } + out := new(HTTPQueryParamMatch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRequestMirrorFilter) DeepCopyInto(out *HTTPRequestMirrorFilter) { + *out = *in + in.BackendRef.DeepCopyInto(&out.BackendRef) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. +func (in *HTTPRequestMirrorFilter) DeepCopy() *HTTPRequestMirrorFilter { + if in == nil { + return nil + } + out := new(HTTPRequestMirrorFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRequestRedirectFilter) DeepCopyInto(out *HTTPRequestRedirectFilter) { + *out = *in + if in.Scheme != nil { + in, out := &in.Scheme, &out.Scheme + *out = new(string) + **out = **in + } + if in.Hostname != nil { + in, out := &in.Hostname, &out.Hostname + *out = new(PreciseHostname) + **out = **in + } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(HTTPPathModifier) + (*in).DeepCopyInto(*out) + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(PortNumber) + **out = **in + } + if in.StatusCode != nil { + in, out := &in.StatusCode, &out.StatusCode + *out = new(int) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestRedirectFilter. +func (in *HTTPRequestRedirectFilter) DeepCopy() *HTTPRequestRedirectFilter { + if in == nil { + return nil + } + out := new(HTTPRequestRedirectFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRoute) DeepCopyInto(out *HTTPRoute) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRoute. +func (in *HTTPRoute) DeepCopy() *HTTPRoute { + if in == nil { + return nil + } + out := new(HTTPRoute) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HTTPRoute) 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 *HTTPRouteFilter) DeepCopyInto(out *HTTPRouteFilter) { + *out = *in + if in.RequestHeaderModifier != nil { + in, out := &in.RequestHeaderModifier, &out.RequestHeaderModifier + *out = new(HTTPHeaderFilter) + (*in).DeepCopyInto(*out) + } + if in.ResponseHeaderModifier != nil { + in, out := &in.ResponseHeaderModifier, &out.ResponseHeaderModifier + *out = new(HTTPHeaderFilter) + (*in).DeepCopyInto(*out) + } + if in.RequestMirror != nil { + in, out := &in.RequestMirror, &out.RequestMirror + *out = new(HTTPRequestMirrorFilter) + (*in).DeepCopyInto(*out) + } + if in.RequestRedirect != nil { + in, out := &in.RequestRedirect, &out.RequestRedirect + *out = new(HTTPRequestRedirectFilter) + (*in).DeepCopyInto(*out) + } + if in.URLRewrite != nil { + in, out := &in.URLRewrite, &out.URLRewrite + *out = new(HTTPURLRewriteFilter) + (*in).DeepCopyInto(*out) + } + if in.ExtensionRef != nil { + in, out := &in.ExtensionRef, &out.ExtensionRef + *out = new(LocalObjectReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteFilter. +func (in *HTTPRouteFilter) DeepCopy() *HTTPRouteFilter { + if in == nil { + return nil + } + out := new(HTTPRouteFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRouteList) DeepCopyInto(out *HTTPRouteList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HTTPRoute, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteList. +func (in *HTTPRouteList) DeepCopy() *HTTPRouteList { + if in == nil { + return nil + } + out := new(HTTPRouteList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HTTPRouteList) 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 *HTTPRouteMatch) DeepCopyInto(out *HTTPRouteMatch) { + *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(HTTPPathMatch) + (*in).DeepCopyInto(*out) + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make([]HTTPHeaderMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.QueryParams != nil { + in, out := &in.QueryParams, &out.QueryParams + *out = make([]HTTPQueryParamMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Method != nil { + in, out := &in.Method, &out.Method + *out = new(HTTPMethod) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteMatch. +func (in *HTTPRouteMatch) DeepCopy() *HTTPRouteMatch { + if in == nil { + return nil + } + out := new(HTTPRouteMatch) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRouteRule) DeepCopyInto(out *HTTPRouteRule) { + *out = *in + if in.Matches != nil { + in, out := &in.Matches, &out.Matches + *out = make([]HTTPRouteMatch, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Filters != nil { + in, out := &in.Filters, &out.Filters + *out = make([]HTTPRouteFilter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.BackendRefs != nil { + in, out := &in.BackendRefs, &out.BackendRefs + *out = make([]HTTPBackendRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Timeouts != nil { + in, out := &in.Timeouts, &out.Timeouts + *out = new(HTTPRouteTimeouts) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteRule. +func (in *HTTPRouteRule) DeepCopy() *HTTPRouteRule { + if in == nil { + return nil + } + out := new(HTTPRouteRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRouteSpec) DeepCopyInto(out *HTTPRouteSpec) { + *out = *in + in.CommonRouteSpec.DeepCopyInto(&out.CommonRouteSpec) + if in.Hostnames != nil { + in, out := &in.Hostnames, &out.Hostnames + *out = make([]Hostname, len(*in)) + copy(*out, *in) + } + if in.Rules != nil { + in, out := &in.Rules, &out.Rules + *out = make([]HTTPRouteRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteSpec. +func (in *HTTPRouteSpec) DeepCopy() *HTTPRouteSpec { + if in == nil { + return nil + } + out := new(HTTPRouteSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRouteStatus) DeepCopyInto(out *HTTPRouteStatus) { + *out = *in + in.RouteStatus.DeepCopyInto(&out.RouteStatus) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteStatus. +func (in *HTTPRouteStatus) DeepCopy() *HTTPRouteStatus { + if in == nil { + return nil + } + out := new(HTTPRouteStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRouteTimeouts) DeepCopyInto(out *HTTPRouteTimeouts) { + *out = *in + if in.Request != nil { + in, out := &in.Request, &out.Request + *out = new(Duration) + **out = **in + } + if in.BackendRequest != nil { + in, out := &in.BackendRequest, &out.BackendRequest + *out = new(Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteTimeouts. +func (in *HTTPRouteTimeouts) DeepCopy() *HTTPRouteTimeouts { + if in == nil { + return nil + } + out := new(HTTPRouteTimeouts) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPURLRewriteFilter) DeepCopyInto(out *HTTPURLRewriteFilter) { + *out = *in + if in.Hostname != nil { + in, out := &in.Hostname, &out.Hostname + *out = new(PreciseHostname) + **out = **in + } + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(HTTPPathModifier) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPURLRewriteFilter. +func (in *HTTPURLRewriteFilter) DeepCopy() *HTTPURLRewriteFilter { + if in == nil { + return nil + } + out := new(HTTPURLRewriteFilter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Listener) DeepCopyInto(out *Listener) { + *out = *in + if in.Hostname != nil { + in, out := &in.Hostname, &out.Hostname + *out = new(Hostname) + **out = **in + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(GatewayTLSConfig) + (*in).DeepCopyInto(*out) + } + if in.AllowedRoutes != nil { + in, out := &in.AllowedRoutes, &out.AllowedRoutes + *out = new(AllowedRoutes) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Listener. +func (in *Listener) DeepCopy() *Listener { + if in == nil { + return nil + } + out := new(Listener) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ListenerStatus) DeepCopyInto(out *ListenerStatus) { + *out = *in + if in.SupportedKinds != nil { + in, out := &in.SupportedKinds, &out.SupportedKinds + *out = make([]RouteGroupKind, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenerStatus. +func (in *ListenerStatus) DeepCopy() *ListenerStatus { + if in == nil { + return nil + } + out := new(ListenerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalObjectReference. +func (in *LocalObjectReference) DeepCopy() *LocalObjectReference { + if in == nil { + return nil + } + out := new(LocalObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParametersReference) DeepCopyInto(out *ParametersReference) { + *out = *in + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParametersReference. +func (in *ParametersReference) DeepCopy() *ParametersReference { + if in == nil { + return nil + } + out := new(ParametersReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParentReference) DeepCopyInto(out *ParentReference) { + *out = *in + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) + **out = **in + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(Kind) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) + **out = **in + } + if in.SectionName != nil { + in, out := &in.SectionName, &out.SectionName + *out = new(SectionName) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(PortNumber) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParentReference. +func (in *ParentReference) DeepCopy() *ParentReference { + if in == nil { + return nil + } + out := new(ParentReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteGroupKind) DeepCopyInto(out *RouteGroupKind) { + *out = *in + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteGroupKind. +func (in *RouteGroupKind) DeepCopy() *RouteGroupKind { + if in == nil { + return nil + } + out := new(RouteGroupKind) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteNamespaces) DeepCopyInto(out *RouteNamespaces) { + *out = *in + if in.From != nil { + in, out := &in.From, &out.From + *out = new(FromNamespaces) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteNamespaces. +func (in *RouteNamespaces) DeepCopy() *RouteNamespaces { + if in == nil { + return nil + } + out := new(RouteNamespaces) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteParentStatus) DeepCopyInto(out *RouteParentStatus) { + *out = *in + in.ParentRef.DeepCopyInto(&out.ParentRef) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteParentStatus. +func (in *RouteParentStatus) DeepCopy() *RouteParentStatus { + if in == nil { + return nil + } + out := new(RouteParentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouteStatus) DeepCopyInto(out *RouteStatus) { + *out = *in + if in.Parents != nil { + in, out := &in.Parents, &out.Parents + *out = make([]RouteParentStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteStatus. +func (in *RouteStatus) DeepCopy() *RouteStatus { + if in == nil { + return nil + } + out := new(RouteStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretObjectReference) DeepCopyInto(out *SecretObjectReference) { + *out = *in + if in.Group != nil { + in, out := &in.Group, &out.Group + *out = new(Group) + **out = **in + } + if in.Kind != nil { + in, out := &in.Kind, &out.Kind + *out = new(Kind) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(Namespace) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretObjectReference. +func (in *SecretObjectReference) DeepCopy() *SecretObjectReference { + if in == nil { + return nil + } + out := new(SecretObjectReference) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.register.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.register.go new file mode 100644 index 000000000..f86709308 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/zz_generated.register.go @@ -0,0 +1,71 @@ +/* +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 register-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "gateway.networking.k8s.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1"} + +// SchemeGroupVersion is group version used to register these objects +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Gateway{}, + &GatewayClass{}, + &GatewayClassList{}, + &GatewayList{}, + &HTTPRoute{}, + &HTTPRouteList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendtlspolicy_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendtlspolicy_types.go new file mode 100644 index 000000000..ee8c2771b --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendtlspolicy_types.go @@ -0,0 +1,138 @@ +/* +Copyright 2023 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 v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// +genclient +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:resource:categories=gateway-api,shortName=btlspolicy +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +// BackendTLSPolicy is a Direct Attached Policy. +// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=Direct" + +// BackendTLSPolicy provides a way to configure how a Gateway +// connects to a Backend via TLS. +type BackendTLSPolicy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec defines the desired state of BackendTLSPolicy. + Spec BackendTLSPolicySpec `json:"spec"` + + // Status defines the current state of BackendTLSPolicy. + Status PolicyStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// BackendTLSPolicyList contains a list of BackendTLSPolicies +type BackendTLSPolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BackendTLSPolicy `json:"items"` +} + +// BackendTLSPolicySpec defines the desired state of BackendTLSPolicy. +// +// Support: Extended +type BackendTLSPolicySpec struct { + // TargetRef identifies an API object to apply the policy to. + // Only Services have Extended support. Implementations MAY support + // additional objects, with Implementation Specific support. + // Note that this config applies to the entire referenced resource + // by default, but this default may change in the future to provide + // a more granular application of the policy. + // + // Support: Extended for Kubernetes Service + // + // Support: Implementation-specific for any other resource + // + TargetRef PolicyTargetReferenceWithSectionName `json:"targetRef"` + + // TLS contains backend TLS policy configuration. + TLS BackendTLSPolicyConfig `json:"tls"` +} + +// BackendTLSPolicyConfig contains backend TLS policy configuration. +// +kubebuilder:validation:XValidation:message="must not contain both CACertRefs and WellKnownCACerts",rule="!(has(self.caCertRefs) && size(self.caCertRefs) > 0 && has(self.wellKnownCACerts) && self.wellKnownCACerts != \"\")" +// +kubebuilder:validation:XValidation:message="must specify either CACertRefs or WellKnownCACerts",rule="(has(self.caCertRefs) && size(self.caCertRefs) > 0 || has(self.wellKnownCACerts) && self.wellKnownCACerts != \"\")" +type BackendTLSPolicyConfig struct { + // CACertRefs contains one or more references to Kubernetes objects that + // contain a PEM-encoded TLS CA certificate bundle, which is used to + // validate a TLS handshake between the Gateway and backend Pod. + // + // If CACertRefs is empty or unspecified, then WellKnownCACerts must be + // specified. Only one of CACertRefs or WellKnownCACerts may be specified, + // not both. If CACertRefs is empty or unspecified, the configuration for + // WellKnownCACerts MUST be honored instead. + // + // References to a resource in a different namespace are invalid for the + // moment, although we will revisit this in the future. + // + // A single CACertRef to a Kubernetes ConfigMap kind has "Core" support. + // Implementations MAY choose to support attaching multiple certificates to + // a backend, but this behavior is implementation-specific. + // + // Support: Core - An optional single reference to a Kubernetes ConfigMap, + // with the CA certificate in a key named `ca.crt`. + // + // Support: Implementation-specific (More than one reference, or other kinds + // of resources). + // + // +kubebuilder:validation:MaxItems=8 + // +optional + CACertRefs []v1beta1.LocalObjectReference `json:"caCertRefs,omitempty"` + + // WellKnownCACerts specifies whether system CA certificates may be used in + // the TLS handshake between the gateway and backend pod. + // + // If WellKnownCACerts is unspecified or empty (""), then CACertRefs must be + // specified with at least one entry for a valid configuration. Only one of + // CACertRefs or WellKnownCACerts may be specified, not both. + // + // Support: Core for "System" + // + // +optional + WellKnownCACerts *WellKnownCACertType `json:"wellKnownCACerts,omitempty"` + + // Hostname is used for two purposes in the connection between Gateways and + // backends: + // + // 1. Hostname MUST be used as the SNI to connect to the backend (RFC 6066). + // 2. Hostname MUST be used for authentication and MUST match the certificate + // served by the matching backend. + // + // Support: Core + Hostname v1beta1.PreciseHostname `json:"hostname"` +} + +// WellKnownCACertType is the type of CA certificate that will be used when +// the TLS.caCertRefs is unspecified. +// +kubebuilder:validation:Enum=System +type WellKnownCACertType string + +const ( + // Indicates that well known system CA certificates should be used. + WellKnownCACertSystem WellKnownCACertType = "System" +) diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gateway_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gateway_types.go index 9eed72d50..bb187e8cb 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gateway_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gateway_types.go @@ -19,15 +19,15 @@ package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/gateway-api/apis/v1beta1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api,shortName=gtw // +kubebuilder:subresource:status -// +kubebuilder:unservedversion -// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of Gateway has been deprecated and will be removed in a future release of the API. Please upgrade to v1beta1." +// +kubebuilder:skipversion +// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of Gateway has been deprecated and will be removed in a future release of the API. Please upgrade to v1." // +kubebuilder:printcolumn:name="Class",type=string,JSONPath=`.spec.gatewayClassName` // +kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.status.addresses[*].value` // +kubebuilder:printcolumn:name="Programmed",type=string,JSONPath=`.status.conditions[?(@.type=="Programmed")].status` @@ -35,7 +35,7 @@ import ( // Gateway represents an instance of a service-traffic handling infrastructure // by binding Listeners to a set of IP addresses. -type Gateway v1beta1.Gateway +type Gateway v1.Gateway // +kubebuilder:object:root=true @@ -53,12 +53,12 @@ type GatewayList struct { // webhook, but there are many cases that will require asynchronous // signaling via the GatewayStatus block. // +k8s:deepcopy-gen=false -type GatewaySpec = v1beta1.GatewaySpec +type GatewaySpec = v1.GatewaySpec // Listener embodies the concept of a logical endpoint where a Gateway accepts // network connections. // +k8s:deepcopy-gen=false -type Listener = v1beta1.Listener +type Listener = v1.Listener // ProtocolType defines the application protocol accepted by a Listener. // Implementations are not required to accept all the defined protocols. If an @@ -88,11 +88,11 @@ type Listener = v1beta1.Listener // +kubebuilder:validation:MaxLength=255 // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$` // +k8s:deepcopy-gen=false -type ProtocolType = v1beta1.ProtocolType +type ProtocolType = v1.ProtocolType // GatewayTLSConfig describes a TLS configuration. // +k8s:deepcopy-gen=false -type GatewayTLSConfig = v1beta1.GatewayTLSConfig +type GatewayTLSConfig = v1.GatewayTLSConfig // TLSModeType type defines how a Gateway handles TLS sessions. // @@ -105,11 +105,11 @@ type GatewayTLSConfig = v1beta1.GatewayTLSConfig // // +kubebuilder:validation:Enum=Terminate;Passthrough // +k8s:deepcopy-gen=false -type TLSModeType = v1beta1.TLSModeType +type TLSModeType = v1.TLSModeType // AllowedRoutes defines which Routes may be attached to this Listener. // +k8s:deepcopy-gen=false -type AllowedRoutes = v1beta1.AllowedRoutes +type AllowedRoutes = v1.AllowedRoutes // FromNamespaces specifies namespace from which Routes may be attached to a // Gateway. @@ -123,46 +123,46 @@ type AllowedRoutes = v1beta1.AllowedRoutes // // +kubebuilder:validation:Enum=All;Selector;Same // +k8s:deepcopy-gen=false -type FromNamespaces = v1beta1.FromNamespaces +type FromNamespaces = v1.FromNamespaces // RouteNamespaces indicate which namespaces Routes should be selected from. // +k8s:deepcopy-gen=false -type RouteNamespaces = v1beta1.RouteNamespaces +type RouteNamespaces = v1.RouteNamespaces // RouteGroupKind indicates the group and kind of a Route resource. // +k8s:deepcopy-gen=false -type RouteGroupKind = v1beta1.RouteGroupKind +type RouteGroupKind = v1.RouteGroupKind // GatewayAddress describes an address that can be bound to a Gateway. // +k8s:deepcopy-gen=false -type GatewayAddress = v1beta1.GatewayAddress +type GatewayAddress = v1.GatewayAddress // GatewayStatus defines the observed state of Gateway. // +k8s:deepcopy-gen=false -type GatewayStatus = v1beta1.GatewayStatus +type GatewayStatus = v1.GatewayStatus // GatewayConditionType is a type of condition associated with a // Gateway. This type should be used with the GatewayStatus.Conditions // field. // +k8s:deepcopy-gen=false -type GatewayConditionType = v1beta1.GatewayConditionType +type GatewayConditionType = v1.GatewayConditionType // GatewayConditionReason defines the set of reasons that explain why a // particular Gateway condition type has been raised. // +k8s:deepcopy-gen=false -type GatewayConditionReason = v1beta1.GatewayConditionReason +type GatewayConditionReason = v1.GatewayConditionReason // ListenerStatus is the status associated with a Listener. // +k8s:deepcopy-gen=false -type ListenerStatus = v1beta1.ListenerStatus +type ListenerStatus = v1.ListenerStatus // ListenerConditionType is a type of condition associated with the // listener. This type should be used with the ListenerStatus.Conditions // field. // +k8s:deepcopy-gen=false -type ListenerConditionType = v1beta1.ListenerConditionType +type ListenerConditionType = v1.ListenerConditionType // ListenerConditionReason defines the set of reasons that explain // why a particular Listener condition type has been raised. // +k8s:deepcopy-gen=false -type ListenerConditionReason = v1beta1.ListenerConditionReason +type ListenerConditionReason = v1.ListenerConditionReason diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gatewayclass_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gatewayclass_types.go index 87d08ebff..df6ef4b9c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gatewayclass_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/gatewayclass_types.go @@ -19,7 +19,7 @@ package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/gateway-api/apis/v1beta1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient @@ -27,8 +27,8 @@ import ( // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc // +kubebuilder:subresource:status -// +kubebuilder:unservedversion -// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of GatewayClass has been deprecated and will be removed in a future release of the API. Please upgrade to v1beta1." +// +kubebuilder:skipversion +// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of GatewayClass has been deprecated and will be removed in a future release of the API. Please upgrade to v1." // +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName` // +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status` // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` @@ -51,7 +51,7 @@ import ( // Gateway is not deleted while in use. // // GatewayClass is a Cluster level resource. -type GatewayClass v1beta1.GatewayClass +type GatewayClass v1.GatewayClass // +kubebuilder:object:root=true @@ -64,24 +64,24 @@ type GatewayClassList struct { // GatewayClassSpec reflects the configuration of a class of Gateways. // +k8s:deepcopy-gen=false -type GatewayClassSpec = v1beta1.GatewayClassSpec +type GatewayClassSpec = v1.GatewayClassSpec // ParametersReference identifies an API object containing controller-specific // configuration resource within the cluster. // +k8s:deepcopy-gen=false -type ParametersReference = v1beta1.ParametersReference +type ParametersReference = v1.ParametersReference // GatewayClassConditionType is the type for status conditions on // Gateway resources. This type should be used with the // GatewayClassStatus.Conditions field. // +k8s:deepcopy-gen=false -type GatewayClassConditionType = v1beta1.GatewayClassConditionType +type GatewayClassConditionType = v1.GatewayClassConditionType // GatewayClassConditionReason defines the set of reasons that explain why a // particular GatewayClass condition type has been raised. // +k8s:deepcopy-gen=false -type GatewayClassConditionReason = v1beta1.GatewayClassConditionReason +type GatewayClassConditionReason = v1.GatewayClassConditionReason // GatewayClassStatus is the current status for the GatewayClass. // +k8s:deepcopy-gen=false -type GatewayClassStatus = v1beta1.GatewayClassStatus +type GatewayClassStatus = v1.GatewayClassStatus diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/grpcroute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/grpcroute_types.go index 54c116411..c5ae6ea2e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/grpcroute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/grpcroute_types.go @@ -19,7 +19,7 @@ package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/gateway-api/apis/v1beta1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient @@ -421,7 +421,7 @@ const ( GRPCHeaderMatchRegularExpression GRPCHeaderMatchType = "RegularExpression" ) -type GRPCHeaderName v1beta1.HeaderName +type GRPCHeaderName v1.HeaderName // GRPCRouteFilterType identifies a type of GRPCRoute filter. type GRPCRouteFilterType string @@ -549,6 +549,29 @@ type GRPCRouteFilter struct { } // GRPCBackendRef defines how a GRPCRoute forwards a gRPC request. +// +// Note that when a namespace different than the local namespace is specified, a +// ReferenceGrant object is required in the referent namespace to allow that +// namespace's owner to accept the reference. See the ReferenceGrant +// documentation for details. +// +// +// +// When the BackendRef points to a Kubernetes Service, implementations SHOULD +// honor the appProtocol field if it is set for the target Service Port. +// +// Implementations supporting appProtocol SHOULD recognize the Kubernetes +// Standard Application Protocols defined in KEP-3726. +// +// If a Service appProtocol isn't specified, an implementation MAY infer the +// backend protocol through its own means. Implementations MAY infer the +// protocol from the Route type referring to the backend Service. +// +// If a Route is not able to send traffic to the backend using the specified +// protocol then the backend is considered invalid. Implementations MUST set the +// "ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason. +// +// type GRPCBackendRef struct { // BackendRef is a reference to a backend to forward matched requests to. // diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/httproute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/httproute_types.go index 20e1e3258..caf5efac0 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/httproute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/httproute_types.go @@ -19,15 +19,15 @@ package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sigs.k8s.io/gateway-api/apis/v1beta1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api // +kubebuilder:subresource:status -// +kubebuilder:unservedversion -// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of HTTPRoute has been deprecated and will be removed in a future release of the API. Please upgrade to v1beta1." +// +kubebuilder:skipversion +// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of HTTPRoute has been deprecated and will be removed in a future release of the API. Please upgrade to v1." // +kubebuilder:printcolumn:name="Hostnames",type=string,JSONPath=`.spec.hostnames` // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` @@ -35,7 +35,7 @@ import ( // to match requests by hostname, path, header, or query param. Filters can be // used to specify additional processing steps. Backends specify where matching // requests should be routed. -type HTTPRoute v1beta1.HTTPRoute +type HTTPRoute v1.HTTPRoute // +kubebuilder:object:root=true @@ -48,13 +48,13 @@ type HTTPRouteList struct { // HTTPRouteSpec defines the desired state of HTTPRoute // +k8s:deepcopy-gen=false -type HTTPRouteSpec = v1beta1.HTTPRouteSpec +type HTTPRouteSpec = v1.HTTPRouteSpec // HTTPRouteRule defines semantics for matching an HTTP request based on // conditions (matches), processing it (filters), and forwarding the request to // an API object (backendRefs). // +k8s:deepcopy-gen=false -type HTTPRouteRule = v1beta1.HTTPRouteRule +type HTTPRouteRule = v1.HTTPRouteRule // PathMatchType specifies the semantics of how HTTP paths should be compared. // Valid PathMatchType values, along with their conformance level, are: @@ -77,11 +77,11 @@ type HTTPRouteRule = v1beta1.HTTPRouteRule // // +kubebuilder:validation:Enum=Exact;PathPrefix;RegularExpression // +k8s:deepcopy-gen=false -type PathMatchType = v1beta1.PathMatchType +type PathMatchType = v1.PathMatchType // HTTPPathMatch describes how to select a HTTP route by matching the HTTP request path. // +k8s:deepcopy-gen=false -type HTTPPathMatch = v1beta1.HTTPPathMatch +type HTTPPathMatch = v1.HTTPPathMatch // HeaderMatchType specifies the semantics of how HTTP header values should be // compared. Valid HeaderMatchType values, along with their conformance levels, are: @@ -98,7 +98,7 @@ type HTTPPathMatch = v1beta1.HTTPPathMatch // // +kubebuilder:validation:Enum=Exact;RegularExpression // +k8s:deepcopy-gen=false -type HeaderMatchType = v1beta1.HeaderMatchType +type HeaderMatchType = v1.HeaderMatchType // HTTPHeaderName is the name of an HTTP header. // @@ -113,12 +113,12 @@ type HeaderMatchType = v1beta1.HeaderMatchType // // * "/invalid" - "/" is an invalid character // +k8s:deepcopy-gen=false -type HTTPHeaderName = v1beta1.HeaderName +type HTTPHeaderName = v1.HeaderName // HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request // headers. // +k8s:deepcopy-gen=false -type HTTPHeaderMatch = v1beta1.HTTPHeaderMatch +type HTTPHeaderMatch = v1.HTTPHeaderMatch // QueryParamMatchType specifies the semantics of how HTTP query parameter // values should be compared. Valid QueryParamMatchType values, along with their @@ -136,12 +136,12 @@ type HTTPHeaderMatch = v1beta1.HTTPHeaderMatch // // +kubebuilder:validation:Enum=Exact;RegularExpression // +k8s:deepcopy-gen=false -type QueryParamMatchType = v1beta1.QueryParamMatchType +type QueryParamMatchType = v1.QueryParamMatchType // HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP // query parameters. // +k8s:deepcopy-gen=false -type HTTPQueryParamMatch = v1beta1.HTTPQueryParamMatch +type HTTPQueryParamMatch = v1.HTTPQueryParamMatch // HTTPMethod describes how to select a HTTP route by matching the HTTP // method as defined by @@ -158,7 +158,7 @@ type HTTPQueryParamMatch = v1beta1.HTTPQueryParamMatch // // +kubebuilder:validation:Enum=GET;HEAD;POST;PUT;DELETE;CONNECT;OPTIONS;TRACE;PATCH // +k8s:deepcopy-gen=false -type HTTPMethod = v1beta1.HTTPMethod +type HTTPMethod = v1.HTTPMethod // HTTPRouteMatch defines the predicate used to match requests to a given // action. Multiple match types are ANDed together, i.e. the match will @@ -178,7 +178,7 @@ type HTTPMethod = v1beta1.HTTPMethod // // ``` // +k8s:deepcopy-gen=false -type HTTPRouteMatch = v1beta1.HTTPRouteMatch +type HTTPRouteMatch = v1.HTTPRouteMatch // HTTPRouteFilter defines processing steps that must be completed during the // request or response lifecycle. HTTPRouteFilters are meant as an extension @@ -187,34 +187,38 @@ type HTTPRouteMatch = v1beta1.HTTPRouteMatch // authentication strategies, rate-limiting, and traffic shaping. API // guarantee/conformance is defined based on the type of the filter. // +k8s:deepcopy-gen=false -type HTTPRouteFilter = v1beta1.HTTPRouteFilter +type HTTPRouteFilter = v1.HTTPRouteFilter // HTTPRouteFilterType identifies a type of HTTPRoute filter. // +k8s:deepcopy-gen=false -type HTTPRouteFilterType = v1beta1.HTTPRouteFilterType +type HTTPRouteFilterType = v1.HTTPRouteFilterType + +// HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute. +// +k8s:deepcopy-gen=false +type HTTPRouteTimeouts = v1.HTTPRouteTimeouts // HTTPHeader represents an HTTP Header name and value as defined by RFC 7230. // +k8s:deepcopy-gen=false -type HTTPHeader = v1beta1.HTTPHeader +type HTTPHeader = v1.HTTPHeader // HTTPHeaderFilter defines a filter that modifies the headers of an HTTP request // or response. // +k8s:deepcopy-gen=false -type HTTPHeaderFilter = v1beta1.HTTPHeaderFilter +type HTTPHeaderFilter = v1.HTTPHeaderFilter // HTTPPathModifierType defines the type of path redirect or rewrite. // +k8s:deepcopy-gen=false -type HTTPPathModifierType = v1beta1.HTTPPathModifierType +type HTTPPathModifierType = v1.HTTPPathModifierType // HTTPPathModifier defines configuration for path modifiers. // // +k8s:deepcopy-gen=false -type HTTPPathModifier = v1beta1.HTTPPathModifier +type HTTPPathModifier = v1.HTTPPathModifier // HTTPRequestRedirect defines a filter that redirects a request. This filter // MUST NOT be used on the same Route rule as a HTTPURLRewrite filter. // +k8s:deepcopy-gen=false -type HTTPRequestRedirectFilter = v1beta1.HTTPRequestRedirectFilter +type HTTPRequestRedirectFilter = v1.HTTPRequestRedirectFilter // HTTPURLRewriteFilter defines a filter that modifies a request during // forwarding. At most one of these filters may be used on a Route rule. This @@ -224,16 +228,16 @@ type HTTPRequestRedirectFilter = v1beta1.HTTPRequestRedirectFilter // // // +k8s:deepcopy-gen=false -type HTTPURLRewriteFilter = v1beta1.HTTPURLRewriteFilter +type HTTPURLRewriteFilter = v1.HTTPURLRewriteFilter // HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. // +k8s:deepcopy-gen=false -type HTTPRequestMirrorFilter = v1beta1.HTTPRequestMirrorFilter +type HTTPRequestMirrorFilter = v1.HTTPRequestMirrorFilter // HTTPBackendRef defines how a HTTPRoute should forward an HTTP request. // +k8s:deepcopy-gen=false -type HTTPBackendRef = v1beta1.HTTPBackendRef +type HTTPBackendRef = v1.HTTPBackendRef // HTTPRouteStatus defines the observed state of HTTPRoute. // +k8s:deepcopy-gen=false -type HTTPRouteStatus = v1beta1.HTTPRouteStatus +type HTTPRouteStatus = v1.HTTPRouteStatus diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/object_reference_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/object_reference_types.go index f2798e597..13ae680cf 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/object_reference_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/object_reference_types.go @@ -16,7 +16,7 @@ limitations under the License. package v1alpha2 -import "sigs.k8s.io/gateway-api/apis/v1beta1" +import v1 "sigs.k8s.io/gateway-api/apis/v1" // LocalObjectReference identifies an API object within the namespace of the // referrer. @@ -27,7 +27,7 @@ import "sigs.k8s.io/gateway-api/apis/v1beta1" // be rejected by the implementation, with appropriate Conditions set // on the containing object. // +k8s:deepcopy-gen=false -type LocalObjectReference = v1beta1.LocalObjectReference +type LocalObjectReference = v1.LocalObjectReference // SecretObjectReference identifies an API object including its namespace, // defaulting to Secret. @@ -39,7 +39,7 @@ type LocalObjectReference = v1beta1.LocalObjectReference // be rejected by the implementation, with appropriate Conditions set // on the containing object. // +k8s:deepcopy-gen=false -type SecretObjectReference = v1beta1.SecretObjectReference +type SecretObjectReference = v1.SecretObjectReference // BackendObjectReference defines how an ObjectReference that is // specific to BackendRef. It includes a few additional fields and features @@ -57,4 +57,4 @@ type SecretObjectReference = v1beta1.SecretObjectReference // be rejected by the implementation, with appropriate Conditions set // on the containing object. // +k8s:deepcopy-gen=false -type BackendObjectReference = v1beta1.BackendObjectReference +type BackendObjectReference = v1.BackendObjectReference diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/policy_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/policy_types.go index 83c8107a2..092e743e6 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/policy_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/policy_types.go @@ -16,6 +16,21 @@ limitations under the License. package v1alpha2 +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // PolicyLabelKey is the label whose presence identifies a CRD that the + // Gateway API Policy attachment model. The value of the label SHOULD be one + // of the following: + // - A label value of "Inherited" indicates that this Policy is inheritable. + // An example of inheritable policy is one which if applied at the Gateway + // level would affect all attached HTTPRoutes and their respective + // Backends. + // - A label value of "Direct" indicates that the policy only affects the + // resource to which it is attached and does not affect it's sub resources. + PolicyLabelKey = "gateway.networking.k8s.io/policy" +) + // PolicyTargetReference identifies an API object to apply a direct or // inherited policy to. This should be used as part of Policy resources // that can target Gateway API resources. For more information on how this @@ -107,3 +122,99 @@ const ( // policy is attached to an invalid target resource. PolicyReasonTargetNotFound PolicyConditionReason = "TargetNotFound" ) + +// PolicyAncestorStatus describes the status of a route with respect to an +// associated Ancestor. +// +// Ancestors refer to objects that are either the Target of a policy or above it +// in terms of object hierarchy. For example, if a policy targets a Service, the +// Policy's Ancestors are, in order, the Service, the HTTPRoute, the Gateway, and +// the GatewayClass. Almost always, in this hierarchy, the Gateway will be the most +// useful object to place Policy status on, so we recommend that implementations +// SHOULD use Gateway as the PolicyAncestorStatus object unless the designers +// have a _very_ good reason otherwise. +// +// In the context of policy attachment, the Ancestor is used to distinguish which +// resource results in a distinct application of this policy. For example, if a policy +// targets a Service, it may have a distinct result per attached Gateway. +// +// Policies targeting the same resource may have different effects depending on the +// ancestors of those resources. For example, different Gateways targeting the same +// Service may have different capabilities, especially if they have different underlying +// implementations. +// +// For example, in BackendTLSPolicy, the Policy attaches to a Service that is +// used as a backend in a HTTPRoute that is itself attached to a Gateway. +// In this case, the relevant object for status is the Gateway, and that is the +// ancestor object referred to in this status. +// +// Note that a parent is also an ancestor, so for objects where the parent is the +// relevant object for status, this struct SHOULD still be used. +// +// This struct is intended to be used in a slice that's effectively a map, +// with a composite key made up of the AncestorRef and the ControllerName. +type PolicyAncestorStatus struct { + // AncestorRef corresponds with a ParentRef in the spec that this + // PolicyAncestorStatus struct describes the status of. + AncestorRef ParentReference `json:"ancestorRef"` + + // ControllerName is a domain/path string that indicates the name of the + // controller that wrote this status. This corresponds with the + // controllerName field on GatewayClass. + // + // Example: "example.net/gateway-controller". + // + // The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are + // valid Kubernetes names + // (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). + // + // Controllers MUST populate this field when writing status. Controllers should ensure that + // entries to status populated with their ControllerName are cleaned up when they are no + // longer necessary. + ControllerName GatewayController `json:"controllerName"` + + // Conditions describes the status of the Policy with respect to the given Ancestor. + // + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=8 + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// PolicyStatus defines the common attributes that all Policies should include within +// their status. +type PolicyStatus struct { + // Ancestors is a list of ancestor resources (usually Gateways) that are + // associated with the policy, and the status of the policy with respect to + // each ancestor. When this policy attaches to a parent, the controller that + // manages the parent and the ancestors MUST add an entry to this list when + // the controller first sees the policy and SHOULD update the entry as + // appropriate when the relevant ancestor is modified. + // + // Note that choosing the relevant ancestor is left to the Policy designers; + // an important part of Policy design is designing the right object level at + // which to namespace this status. + // + // Note also that implementations MUST ONLY populate ancestor status for + // the Ancestor resources they are responsible for. Implementations MUST + // use the ControllerName field to uniquely identify the entries in this list + // that they are responsible for. + // + // Note that to achieve this, the list of PolicyAncestorStatus structs + // MUST be treated as a map with a composite key, made up of the AncestorRef + // and ControllerName fields combined. + // + // A maximum of 16 ancestors will be represented in this list. An empty list + // means the Policy is not relevant for any ancestors. + // + // If this slice is full, implementations MUST NOT add further entries. + // Instead they MUST consider the policy unimplementable and signal that + // on any related resources such as the ancestor that would be referenced + // here. For example, if this list was full on BackendTLSPolicy, no + // additional Gateways would be able to reference the Service targeted by + // the BackendTLSPolicy. + // + // +kubebuilder:validation:MaxItems=16 + Ancestors []PolicyAncestorStatus `json:"ancestors"` +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/shared_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/shared_types.go index 788fef9a0..4ff14aace 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/shared_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/shared_types.go @@ -16,9 +16,7 @@ limitations under the License. package v1alpha2 -import ( - "sigs.k8s.io/gateway-api/apis/v1beta1" -) +import v1 "sigs.k8s.io/gateway-api/apis/v1" // ParentReference identifies an API object (usually a Gateway) that can be considered // a parent of this resource (usually a route). The only kind of parent resource @@ -34,18 +32,18 @@ import ( // The API object must be valid in the cluster; the Group and Kind must // be registered in the cluster for this reference to be valid. // +k8s:deepcopy-gen=false -type ParentReference = v1beta1.ParentReference +type ParentReference = v1.ParentReference // CommonRouteSpec defines the common attributes that all Routes MUST include // within their spec. // +k8s:deepcopy-gen=false -type CommonRouteSpec = v1beta1.CommonRouteSpec +type CommonRouteSpec = v1.CommonRouteSpec // PortNumber defines a network port. // // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=65535 -type PortNumber = v1beta1.PortNumber +type PortNumber = v1.PortNumber // BackendRef defines how a Route should forward a request to a Kubernetes // resource. @@ -55,13 +53,13 @@ type PortNumber = v1beta1.PortNumber // namespace's owner to accept the reference. See the ReferenceGrant // documentation for details. // +k8s:deepcopy-gen=false -type BackendRef = v1beta1.BackendRef +type BackendRef = v1.BackendRef // RouteConditionType is a type of condition for a route. -type RouteConditionType = v1beta1.RouteConditionType +type RouteConditionType = v1.RouteConditionType // RouteConditionReason is a reason for a route condition. -type RouteConditionReason = v1beta1.RouteConditionReason +type RouteConditionReason = v1.RouteConditionReason const ( // This condition indicates whether the route has been accepted or rejected @@ -148,12 +146,12 @@ const ( // RouteParentStatus describes the status of a route with respect to an // associated Parent. // +k8s:deepcopy-gen=false -type RouteParentStatus = v1beta1.RouteParentStatus +type RouteParentStatus = v1.RouteParentStatus // RouteStatus defines the common attributes that all Routes MUST include within // their status. // +k8s:deepcopy-gen=false -type RouteStatus = v1beta1.RouteStatus +type RouteStatus = v1.RouteStatus // Hostname is the fully qualified domain name of a network host. This matches // the RFC 1123 definition of a hostname with 2 notable exceptions: @@ -173,7 +171,7 @@ type RouteStatus = v1beta1.RouteStatus // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -type Hostname = v1beta1.Hostname +type Hostname = v1.Hostname // PreciseHostname is the fully qualified domain name of a network host. This // matches the RFC 1123 definition of a hostname with 1 notable exception that @@ -186,7 +184,7 @@ type Hostname = v1beta1.Hostname // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -type PreciseHostname = v1beta1.PreciseHostname +type PreciseHostname = v1.PreciseHostname // Group refers to a Kubernetes Group. It must either be an empty string or a // RFC 1123 subdomain. @@ -206,7 +204,7 @@ type PreciseHostname = v1beta1.PreciseHostname // // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -type Group = v1beta1.Group +type Group = v1.Group // Kind refers to a Kubernetes Kind. // @@ -222,7 +220,7 @@ type Group = v1beta1.Group // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=63 // +kubebuilder:validation:Pattern=`^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` -type Kind = v1beta1.Kind +type Kind = v1.Kind // ObjectName refers to the name of a Kubernetes object. // Object names can have a variety of forms, including RFC1123 subdomains, @@ -230,7 +228,7 @@ type Kind = v1beta1.Kind // // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 -type ObjectName = v1beta1.ObjectName +type ObjectName = v1.ObjectName // Namespace refers to a Kubernetes namespace. It must be a RFC 1123 label. // @@ -251,7 +249,7 @@ type ObjectName = v1beta1.ObjectName // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=63 -type Namespace = v1beta1.Namespace +type Namespace = v1.Namespace // SectionName is the name of a section in a Kubernetes resource. // @@ -270,7 +268,7 @@ type Namespace = v1beta1.Namespace // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 -type SectionName = v1beta1.SectionName +type SectionName = v1.SectionName // GatewayController is the name of a Gateway API controller. It must be a // domain prefixed path. @@ -287,7 +285,7 @@ type SectionName = v1beta1.SectionName // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` -type GatewayController = v1beta1.GatewayController +type GatewayController = v1.GatewayController // AnnotationKey is the key of an annotation in Gateway API. This is used for // validation of maps such as TLS options. This matches the Kubernetes @@ -309,7 +307,7 @@ type GatewayController = v1beta1.GatewayController // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]/?)*$` -type AnnotationKey = v1beta1.AnnotationKey +type AnnotationKey = v1.AnnotationKey // AnnotationValue is the value of an annotation in Gateway API. This is used // for validation of maps such as TLS options. This roughly matches Kubernetes @@ -318,7 +316,7 @@ type AnnotationKey = v1beta1.AnnotationKey // // +kubebuilder:validation:MinLength=0 // +kubebuilder:validation:MaxLength=4096 -type AnnotationValue = v1beta1.AnnotationValue +type AnnotationValue = v1.AnnotationValue // AddressType defines how a network address is represented as a text string. // This may take two possible forms: @@ -338,11 +336,11 @@ type AnnotationValue = v1beta1.AnnotationValue // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^Hostname|IPAddress|NamedAddress|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` -type AddressType = v1beta1.AddressType +type AddressType = v1.AddressType // Duration is a string value representing a duration in time. The format is as specified // in GEP-2257, a strict subset of the syntax parsed by Golang time.ParseDuration. -type Duration = v1beta1.Duration +type Duration = v1.Duration const ( // A textual representation of a numeric IP address. IPv4 diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.deepcopy.go index 890f57faf..c3486ee05 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.deepcopy.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.deepcopy.go @@ -21,10 +21,112 @@ limitations under the License. package v1alpha2 import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "sigs.k8s.io/gateway-api/apis/v1beta1" + "sigs.k8s.io/gateway-api/apis/v1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTLSPolicy) DeepCopyInto(out *BackendTLSPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSPolicy. +func (in *BackendTLSPolicy) DeepCopy() *BackendTLSPolicy { + if in == nil { + return nil + } + out := new(BackendTLSPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackendTLSPolicy) 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 *BackendTLSPolicyConfig) DeepCopyInto(out *BackendTLSPolicyConfig) { + *out = *in + if in.CACertRefs != nil { + in, out := &in.CACertRefs, &out.CACertRefs + *out = make([]v1.LocalObjectReference, len(*in)) + copy(*out, *in) + } + if in.WellKnownCACerts != nil { + in, out := &in.WellKnownCACerts, &out.WellKnownCACerts + *out = new(WellKnownCACertType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSPolicyConfig. +func (in *BackendTLSPolicyConfig) DeepCopy() *BackendTLSPolicyConfig { + if in == nil { + return nil + } + out := new(BackendTLSPolicyConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BackendTLSPolicyList) DeepCopyInto(out *BackendTLSPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BackendTLSPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSPolicyList. +func (in *BackendTLSPolicyList) DeepCopy() *BackendTLSPolicyList { + if in == nil { + return nil + } + out := new(BackendTLSPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BackendTLSPolicyList) 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 *BackendTLSPolicySpec) DeepCopyInto(out *BackendTLSPolicySpec) { + *out = *in + in.TargetRef.DeepCopyInto(&out.TargetRef) + in.TLS.DeepCopyInto(&out.TLS) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSPolicySpec. +func (in *BackendTLSPolicySpec) DeepCopy() *BackendTLSPolicySpec { + if in == nil { + return nil + } + out := new(BackendTLSPolicySpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GRPCBackendRef) DeepCopyInto(out *GRPCBackendRef) { *out = *in @@ -53,7 +155,7 @@ func (in *GRPCHeaderMatch) DeepCopyInto(out *GRPCHeaderMatch) { *out = *in if in.Type != nil { in, out := &in.Type, &out.Type - *out = new(v1beta1.HeaderMatchType) + *out = new(v1.HeaderMatchType) **out = **in } } @@ -130,22 +232,22 @@ func (in *GRPCRouteFilter) DeepCopyInto(out *GRPCRouteFilter) { *out = *in if in.RequestHeaderModifier != nil { in, out := &in.RequestHeaderModifier, &out.RequestHeaderModifier - *out = new(v1beta1.HTTPHeaderFilter) + *out = new(v1.HTTPHeaderFilter) (*in).DeepCopyInto(*out) } if in.ResponseHeaderModifier != nil { in, out := &in.ResponseHeaderModifier, &out.ResponseHeaderModifier - *out = new(v1beta1.HTTPHeaderFilter) + *out = new(v1.HTTPHeaderFilter) (*in).DeepCopyInto(*out) } if in.RequestMirror != nil { in, out := &in.RequestMirror, &out.RequestMirror - *out = new(v1beta1.HTTPRequestMirrorFilter) + *out = new(v1.HTTPRequestMirrorFilter) (*in).DeepCopyInto(*out) } if in.ExtensionRef != nil { in, out := &in.ExtensionRef, &out.ExtensionRef - *out = new(v1beta1.LocalObjectReference) + *out = new(v1.LocalObjectReference) **out = **in } } @@ -261,7 +363,7 @@ func (in *GRPCRouteSpec) DeepCopyInto(out *GRPCRouteSpec) { in.CommonRouteSpec.DeepCopyInto(&out.CommonRouteSpec) if in.Hostnames != nil { in, out := &in.Hostnames, &out.Hostnames - *out = make([]v1beta1.Hostname, len(*in)) + *out = make([]v1.Hostname, len(*in)) copy(*out, *in) } if in.Rules != nil { @@ -476,12 +578,57 @@ func (in *HTTPRouteList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PolicyAncestorStatus) DeepCopyInto(out *PolicyAncestorStatus) { + *out = *in + in.AncestorRef.DeepCopyInto(&out.AncestorRef) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyAncestorStatus. +func (in *PolicyAncestorStatus) DeepCopy() *PolicyAncestorStatus { + if in == nil { + return nil + } + out := new(PolicyAncestorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PolicyStatus) DeepCopyInto(out *PolicyStatus) { + *out = *in + if in.Ancestors != nil { + in, out := &in.Ancestors, &out.Ancestors + *out = make([]PolicyAncestorStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyStatus. +func (in *PolicyStatus) DeepCopy() *PolicyStatus { + if in == nil { + return nil + } + out := new(PolicyStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PolicyTargetReference) DeepCopyInto(out *PolicyTargetReference) { *out = *in if in.Namespace != nil { in, out := &in.Namespace, &out.Namespace - *out = new(v1beta1.Namespace) + *out = new(v1.Namespace) **out = **in } } @@ -502,7 +649,7 @@ func (in *PolicyTargetReferenceWithSectionName) DeepCopyInto(out *PolicyTargetRe in.PolicyTargetReference.DeepCopyInto(&out.PolicyTargetReference) if in.SectionName != nil { in, out := &in.SectionName, &out.SectionName - *out = new(v1beta1.SectionName) + *out = new(v1.SectionName) **out = **in } } @@ -639,7 +786,7 @@ func (in *TCPRouteRule) DeepCopyInto(out *TCPRouteRule) { *out = *in if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs - *out = make([]v1beta1.BackendRef, len(*in)) + *out = make([]v1.BackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -759,7 +906,7 @@ func (in *TLSRouteRule) DeepCopyInto(out *TLSRouteRule) { *out = *in if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs - *out = make([]v1beta1.BackendRef, len(*in)) + *out = make([]v1.BackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -782,7 +929,7 @@ func (in *TLSRouteSpec) DeepCopyInto(out *TLSRouteSpec) { in.CommonRouteSpec.DeepCopyInto(&out.CommonRouteSpec) if in.Hostnames != nil { in, out := &in.Hostnames, &out.Hostnames - *out = make([]v1beta1.Hostname, len(*in)) + *out = make([]v1.Hostname, len(*in)) copy(*out, *in) } if in.Rules != nil { @@ -884,7 +1031,7 @@ func (in *UDPRouteRule) DeepCopyInto(out *UDPRouteRule) { *out = *in if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs - *out = make([]v1beta1.BackendRef, len(*in)) + *out = make([]v1.BackendRef, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.register.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.register.go index 5bbf46709..618308444 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.register.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/zz_generated.register.go @@ -58,6 +58,8 @@ func init() { // Adds the list of known types to Scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, + &BackendTLSPolicy{}, + &BackendTLSPolicyList{}, &GRPCRoute{}, &GRPCRouteList{}, &Gateway{}, diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gateway_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gateway_types.go index 120f7e2f2..817016669 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gateway_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gateway_types.go @@ -18,6 +18,8 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient @@ -32,18 +34,7 @@ import ( // Gateway represents an instance of a service-traffic handling infrastructure // by binding Listeners to a set of IP addresses. -type Gateway struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of Gateway. - Spec GatewaySpec `json:"spec"` - - // Status defines the current state of Gateway. - // - // +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}} - Status GatewayStatus `json:"status,omitempty"` -} +type Gateway v1.Gateway // +kubebuilder:object:root=true @@ -60,202 +51,13 @@ type GatewayList struct { // valid. Some invalid configurations can be caught synchronously via a // webhook, but there are many cases that will require asynchronous // signaling via the GatewayStatus block. -type GatewaySpec struct { - // GatewayClassName used for this Gateway. This is the name of a - // GatewayClass resource. - GatewayClassName ObjectName `json:"gatewayClassName"` - - // Listeners associated with this Gateway. Listeners define - // logical endpoints that are bound on this Gateway's addresses. - // At least one Listener MUST be specified. - // - // Each listener in a Gateway must have a unique combination of Hostname, - // Port, and Protocol. - // - // Within the HTTP Conformance Profile, the below combinations of port and - // protocol are considered Core and MUST be supported: - // - // 1. Port: 80, Protocol: HTTP - // 2. Port: 443, Protocol: HTTPS - // - // Within the TLS Conformance Profile, the below combinations of port and - // protocol are considered Core and MUST be supported: - // - // 1. Port: 443, Protocol: TLS - // - // Port and protocol combinations not listed above are considered Extended. - // - // An implementation MAY group Listeners by Port and then collapse each - // group of Listeners into a single Listener if the implementation - // determines that the Listeners in the group are "compatible". An - // implementation MAY also group together and collapse compatible - // Listeners belonging to different Gateways. - // - // For example, an implementation might consider Listeners to be - // compatible with each other if all of the following conditions are - // met: - // - // 1. Either each Listener within the group specifies the "HTTP" - // Protocol or each Listener within the group specifies either - // the "HTTPS" or "TLS" Protocol. - // - // 2. Each Listener within the group specifies a Hostname that is unique - // within the group. - // - // 3. As a special case, one Listener within a group may omit Hostname, - // in which case this Listener matches when no other Listener - // matches. - // - // If the implementation does collapse compatible Listeners, the - // hostname provided in the incoming client request MUST be - // matched to a Listener to find the correct set of Routes. - // The incoming hostname MUST be matched using the Hostname - // field for each Listener in order of most to least specific. - // That is, exact matches must be processed before wildcard - // matches. - // - // If this field specifies multiple Listeners that have the same - // Port value but are not compatible, the implementation must raise - // a "Conflicted" condition in the Listener status. - // - // Support: Core - // - // +listType=map - // +listMapKey=name - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=64 - // +kubebuilder:validation:XValidation:message="tls must be specified for protocols ['HTTPS', 'TLS']",rule="self.all(l, l.protocol in ['HTTPS', 'TLS'] ? has(l.tls) : true)" - // +kubebuilder:validation:XValidation:message="tls must not be specified for protocols ['HTTP', 'TCP', 'UDP']",rule="self.all(l, l.protocol in ['HTTP', 'TCP', 'UDP'] ? !has(l.tls) : true)" - // +kubebuilder:validation:XValidation:message="hostname must not be specified for protocols ['TCP', 'UDP']",rule="self.all(l, l.protocol in ['TCP', 'UDP'] ? (!has(l.hostname) || l.hostname == '') : true)" - // +kubebuilder:validation:XValidation:message="Listener name must be unique within the Gateway",rule="self.all(l1, self.exists_one(l2, l1.name == l2.name))" - // +kubebuilder:validation:XValidation:message="Combination of port, protocol and hostname must be unique for each listener",rule="self.all(l1, self.exists_one(l2, l1.port == l2.port && l1.protocol == l2.protocol && (has(l1.hostname) && has(l2.hostname) ? l1.hostname == l2.hostname : !has(l1.hostname) && !has(l2.hostname))))" - Listeners []Listener `json:"listeners"` - - // Addresses requested for this Gateway. This is optional and behavior can - // depend on the implementation. If a value is set in the spec and the - // requested address is invalid or unavailable, the implementation MUST - // indicate this in the associated entry in GatewayStatus.Addresses. - // - // The Addresses field represents a request for the address(es) on the - // "outside of the Gateway", that traffic bound for this Gateway will use. - // This could be the IP address or hostname of an external load balancer or - // other networking infrastructure, or some other address that traffic will - // be sent to. - // - // The .listener.hostname field is used to route traffic that has already - // arrived at the Gateway to the correct in-cluster destination. - // - // If no Addresses are specified, the implementation MAY schedule the - // Gateway in an implementation-specific manner, assigning an appropriate - // set of Addresses. - // - // The implementation MUST bind all Listeners to every GatewayAddress that - // it assigns to the Gateway and add a corresponding entry in - // GatewayStatus.Addresses. - // - // Support: Extended - // - // +optional - // - // +kubebuilder:validation:MaxItems=16 - // +kubebuilder:validation:XValidation:message="IPAddress values must be unique",rule="self.all(a1, a1.type == 'IPAddress' ? self.exists_one(a2, a2.type == a1.type && a2.value == a1.value) : true )" - // +kubebuilder:validation:XValidation:message="Hostname values must be unique",rule="self.all(a1, a1.type == 'Hostname' ? self.exists_one(a2, a2.type == a1.type && a2.value == a1.value) : true )" - Addresses []GatewayAddress `json:"addresses,omitempty"` -} +// +k8s:deepcopy-gen=false +type GatewaySpec = v1.GatewaySpec // Listener embodies the concept of a logical endpoint where a Gateway accepts // network connections. -type Listener struct { - // Name is the name of the Listener. This name MUST be unique within a - // Gateway. - // - // Support: Core - Name SectionName `json:"name"` - - // Hostname specifies the virtual hostname to match for protocol types that - // define this concept. When unspecified, all hostnames are matched. This - // field is ignored for protocols that don't require hostname based - // matching. - // - // Implementations MUST apply Hostname matching appropriately for each of - // the following protocols: - // - // * TLS: The Listener Hostname MUST match the SNI. - // * HTTP: The Listener Hostname MUST match the Host header of the request. - // * HTTPS: The Listener Hostname SHOULD match at both the TLS and HTTP - // protocol layers as described above. If an implementation does not - // ensure that both the SNI and Host header match the Listener hostname, - // it MUST clearly document that. - // - // For HTTPRoute and TLSRoute resources, there is an interaction with the - // `spec.hostnames` array. When both listener and route specify hostnames, - // there MUST be an intersection between the values for a Route to be - // accepted. For more information, refer to the Route specific Hostnames - // documentation. - // - // Hostnames that are prefixed with a wildcard label (`*.`) are interpreted - // as a suffix match. That means that a match for `*.example.com` would match - // both `test.example.com`, and `foo.test.example.com`, but not `example.com`. - // - // Support: Core - // - // +optional - Hostname *Hostname `json:"hostname,omitempty"` - - // Port is the network port. Multiple listeners may use the - // same port, subject to the Listener compatibility rules. - // - // Support: Core - Port PortNumber `json:"port"` - - // Protocol specifies the network protocol this listener expects to receive. - // - // Support: Core - Protocol ProtocolType `json:"protocol"` - - // TLS is the TLS configuration for the Listener. This field is required if - // the Protocol field is "HTTPS" or "TLS". It is invalid to set this field - // if the Protocol field is "HTTP", "TCP", or "UDP". - // - // The association of SNIs to Certificate defined in GatewayTLSConfig is - // defined based on the Hostname field for this listener. - // - // The GatewayClass MUST use the longest matching SNI out of all - // available certificates for any TLS handshake. - // - // Support: Core - // - // +optional - TLS *GatewayTLSConfig `json:"tls,omitempty"` - - // AllowedRoutes defines the types of routes that MAY be attached to a - // Listener and the trusted namespaces where those Route resources MAY be - // present. - // - // Although a client request may match multiple route rules, only one rule - // may ultimately receive the request. Matching precedence MUST be - // determined in order of the following criteria: - // - // * The most specific match as defined by the Route type. - // * The oldest Route based on creation timestamp. For example, a Route with - // a creation timestamp of "2020-09-08 01:02:03" is given precedence over - // a Route with a creation timestamp of "2020-09-08 01:02:04". - // * If everything else is equivalent, the Route appearing first in - // alphabetical order (namespace/name) should be given precedence. For - // example, foo/bar is given precedence over foo/baz. - // - // All valid rules within a Route attached to this Listener should be - // implemented. Invalid Route rules can be ignored (sometimes that will mean - // the full Route). If a Route rule transitions from valid to invalid, - // support for that Route rule should be dropped to ensure consistency. For - // example, even if a filter specified by a Route rule is invalid, the rest - // of the rules within that Route should still be supported. - // - // Support: Core - // +kubebuilder:default={namespaces:{from: Same}} - // +optional - AllowedRoutes *AllowedRoutes `json:"allowedRoutes,omitempty"` -} +// +k8s:deepcopy-gen=false +type Listener = v1.Listener // ProtocolType defines the application protocol accepted by a Listener. // Implementations are not required to accept all the defined protocols. If an @@ -269,7 +71,7 @@ type Listener struct { // exist. Such definitions must use prefixed name, such as // `mycompany.com/my-custom-protocol`. Un-prefixed names are reserved for core // protocols. Any protocol defined by implementations will fall under -// Implementation-specific conformance. +// implementation-specific conformance. // // Valid values include: // @@ -284,663 +86,82 @@ type Listener struct { // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=255 // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([-a-zSA-Z0-9]*[a-zA-Z0-9])?$|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9]+$` -type ProtocolType string - -const ( - // Accepts cleartext HTTP/1.1 sessions over TCP. Implementations MAY also - // support HTTP/2 over cleartext. If implementations support HTTP/2 over - // cleartext on "HTTP" listeners, that MUST be clearly documented by the - // implementation. - HTTPProtocolType ProtocolType = "HTTP" - - // Accepts HTTP/1.1 or HTTP/2 sessions over TLS. - HTTPSProtocolType ProtocolType = "HTTPS" - - // Accepts TLS sessions over TCP. - TLSProtocolType ProtocolType = "TLS" - - // Accepts TCP sessions. - TCPProtocolType ProtocolType = "TCP" - - // Accepts UDP packets. - UDPProtocolType ProtocolType = "UDP" -) +// +k8s:deepcopy-gen=false +type ProtocolType = v1.ProtocolType // GatewayTLSConfig describes a TLS configuration. -// -// +kubebuilder:validation:XValidation:message="certificateRefs must be specified when TLSModeType is Terminate",rule="self.mode == 'Terminate' ? size(self.certificateRefs) > 0 : true" -type GatewayTLSConfig struct { - // Mode defines the TLS behavior for the TLS session initiated by the client. - // There are two possible modes: - // - // - Terminate: The TLS session between the downstream client - // and the Gateway is terminated at the Gateway. This mode requires - // certificateRefs to be set and contain at least one element. - // - Passthrough: The TLS session is NOT terminated by the Gateway. This - // implies that the Gateway can't decipher the TLS stream except for - // the ClientHello message of the TLS protocol. - // CertificateRefs field is ignored in this mode. - // - // Support: Core - // - // +optional - // +kubebuilder:default=Terminate - Mode *TLSModeType `json:"mode,omitempty"` - - // CertificateRefs contains a series of references to Kubernetes objects that - // contains TLS certificates and private keys. These certificates are used to - // establish a TLS handshake for requests that match the hostname of the - // associated listener. - // - // A single CertificateRef to a Kubernetes Secret has "Core" support. - // Implementations MAY choose to support attaching multiple certificates to - // a Listener, but this behavior is implementation-specific. - // - // References to a resource in different namespace are invalid UNLESS there - // is a ReferenceGrant in the target namespace that allows the certificate - // to be attached. If a ReferenceGrant does not allow this reference, the - // "ResolvedRefs" condition MUST be set to False for this listener with the - // "RefNotPermitted" reason. - // - // This field is required to have at least one element when the mode is set - // to "Terminate" (default) and is optional otherwise. - // - // CertificateRefs can reference to standard Kubernetes resources, i.e. - // Secret, or implementation-specific custom resources. - // - // Support: Core - A single reference to a Kubernetes Secret of type kubernetes.io/tls - // - // Support: Implementation-specific (More than one reference or other resource types) - // - // +optional - // +kubebuilder:validation:MaxItems=64 - CertificateRefs []SecretObjectReference `json:"certificateRefs,omitempty"` - - // Options are a list of key/value pairs to enable extended TLS - // configuration for each implementation. For example, configuring the - // minimum TLS version or supported cipher suites. - // - // A set of common keys MAY be defined by the API in the future. To avoid - // any ambiguity, implementation-specific definitions MUST use - // domain-prefixed names, such as `example.com/my-custom-option`. - // Un-prefixed names are reserved for key names defined by Gateway API. - // - // Support: Implementation-specific - // - // +optional - // +kubebuilder:validation:MaxProperties=16 - Options map[AnnotationKey]AnnotationValue `json:"options,omitempty"` -} +// +k8s:deepcopy-gen=false +type GatewayTLSConfig = v1.GatewayTLSConfig // TLSModeType type defines how a Gateway handles TLS sessions. // +// Note that values may be added to this enum, implementations +// must ensure that unknown values will not cause a crash. +// +// Unknown values here must result in the implementation setting the +// Ready Condition for the Listener to `status: False`, with a +// Reason of `Invalid`. +// // +kubebuilder:validation:Enum=Terminate;Passthrough -type TLSModeType string - -const ( - // In this mode, TLS session between the downstream client - // and the Gateway is terminated at the Gateway. - TLSModeTerminate TLSModeType = "Terminate" - - // In this mode, the TLS session is NOT terminated by the Gateway. This - // implies that the Gateway can't decipher the TLS stream except for - // the ClientHello message of the TLS protocol. - // - // Note that SSL passthrough is only supported by TLSRoute. - TLSModePassthrough TLSModeType = "Passthrough" -) +// +k8s:deepcopy-gen=false +type TLSModeType = v1.TLSModeType // AllowedRoutes defines which Routes may be attached to this Listener. -type AllowedRoutes struct { - // Namespaces indicates namespaces from which Routes may be attached to this - // Listener. This is restricted to the namespace of this Gateway by default. - // - // Support: Core - // - // +optional - // +kubebuilder:default={from: Same} - Namespaces *RouteNamespaces `json:"namespaces,omitempty"` - - // Kinds specifies the groups and kinds of Routes that are allowed to bind - // to this Gateway Listener. When unspecified or empty, the kinds of Routes - // selected are determined using the Listener protocol. - // - // A RouteGroupKind MUST correspond to kinds of Routes that are compatible - // with the application protocol specified in the Listener's Protocol field. - // If an implementation does not support or recognize this resource type, it - // MUST set the "ResolvedRefs" condition to False for this Listener with the - // "InvalidRouteKinds" reason. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=8 - Kinds []RouteGroupKind `json:"kinds,omitempty"` -} +// +k8s:deepcopy-gen=false +type AllowedRoutes = v1.AllowedRoutes // FromNamespaces specifies namespace from which Routes may be attached to a // Gateway. // +// Note that values may be added to this enum, implementations +// must ensure that unknown values will not cause a crash. +// +// Unknown values here must result in the implementation setting the +// Ready Condition for the Listener to `status: False`, with a +// Reason of `Invalid`. +// // +kubebuilder:validation:Enum=All;Selector;Same -type FromNamespaces string - -const ( - // Routes in all namespaces may be attached to this Gateway. - NamespacesFromAll FromNamespaces = "All" - // Only Routes in namespaces selected by the selector may be attached to - // this Gateway. - NamespacesFromSelector FromNamespaces = "Selector" - // Only Routes in the same namespace as the Gateway may be attached to this - // Gateway. - NamespacesFromSame FromNamespaces = "Same" -) +// +k8s:deepcopy-gen=false +type FromNamespaces = v1.FromNamespaces // RouteNamespaces indicate which namespaces Routes should be selected from. -type RouteNamespaces struct { - // From indicates where Routes will be selected for this Gateway. Possible - // values are: - // - // * All: Routes in all namespaces may be used by this Gateway. - // * Selector: Routes in namespaces selected by the selector may be used by - // this Gateway. - // * Same: Only Routes in the same namespace may be used by this Gateway. - // - // Support: Core - // - // +optional - // +kubebuilder:default=Same - From *FromNamespaces `json:"from,omitempty"` - - // Selector must be specified when From is set to "Selector". In that case, - // only Routes in Namespaces matching this Selector will be selected by this - // Gateway. This field is ignored for other values of "From". - // - // Support: Core - // - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty"` -} +// +k8s:deepcopy-gen=false +type RouteNamespaces = v1.RouteNamespaces // RouteGroupKind indicates the group and kind of a Route resource. -type RouteGroupKind struct { - // Group is the group of the Route. - // - // +optional - // +kubebuilder:default=gateway.networking.k8s.io - Group *Group `json:"group,omitempty"` - - // Kind is the kind of the Route. - Kind Kind `json:"kind"` -} +// +k8s:deepcopy-gen=false +type RouteGroupKind = v1.RouteGroupKind // GatewayAddress describes an address that can be bound to a Gateway. -// -// +kubebuilder:validation:XValidation:message="Hostname value must only contain valid characters (matching ^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$)",rule="self.type == 'Hostname' ? self.value.matches(r\"\"\"^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\"\"\"): true" -type GatewayAddress struct { - // Type of the address. - // - // +optional - // +kubebuilder:default=IPAddress - Type *AddressType `json:"type,omitempty"` - - // Value of the address. The validity of the values will depend - // on the type and support by the controller. - // - // Examples: `1.2.3.4`, `128::1`, `my-ip-address`. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Value string `json:"value"` -} - -// GatewayStatusAddress describes an address that is bound to a Gateway. -// -// +kubebuilder:validation:XValidation:message="Hostname value must only contain valid characters (matching ^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$)",rule="self.type == 'Hostname' ? self.value.matches(r\"\"\"^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$\"\"\"): true" -type GatewayStatusAddress struct { - // Type of the address. - // - // +optional - // +kubebuilder:default=IPAddress - Type *AddressType `json:"type,omitempty"` - - // Value of the address. The validity of the values will depend - // on the type and support by the controller. - // - // Examples: `1.2.3.4`, `128::1`, `my-ip-address`. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Value string `json:"value"` -} +// +k8s:deepcopy-gen=false +type GatewayAddress = v1.GatewayAddress // GatewayStatus defines the observed state of Gateway. -type GatewayStatus struct { - // Addresses lists the IP addresses that have actually been - // bound to the Gateway. These addresses may differ from the - // addresses in the Spec, e.g. if the Gateway automatically - // assigns an address from a reserved pool. - // - // +optional - // - // +kubebuilder:validation:MaxItems=16 - Addresses []GatewayStatusAddress `json:"addresses,omitempty"` - - // Conditions describe the current conditions of the Gateway. - // - // Implementations should prefer to express Gateway conditions - // using the `GatewayConditionType` and `GatewayConditionReason` - // constants so that operators and tools can converge on a common - // vocabulary to describe Gateway state. - // - // Known condition types are: - // - // * "Accepted" - // * "Programmed" - // * "Ready" - // - // +optional - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - // +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}} - Conditions []metav1.Condition `json:"conditions,omitempty"` - - // Listeners provide status for each unique listener port defined in the Spec. - // - // +optional - // +listType=map - // +listMapKey=name - // +kubebuilder:validation:MaxItems=64 - Listeners []ListenerStatus `json:"listeners,omitempty"` -} +// +k8s:deepcopy-gen=false +type GatewayStatus = v1.GatewayStatus // GatewayConditionType is a type of condition associated with a // Gateway. This type should be used with the GatewayStatus.Conditions // field. -type GatewayConditionType string +// +k8s:deepcopy-gen=false +type GatewayConditionType = v1.GatewayConditionType // GatewayConditionReason defines the set of reasons that explain why a // particular Gateway condition type has been raised. -type GatewayConditionReason string - -const ( - // This condition indicates whether a Gateway has generated some - // configuration that is assumed to be ready soon in the underlying data - // plane. - // - // It is a positive-polarity summary condition, and so should always be - // present on the resource with ObservedGeneration set. - // - // It should be set to Unknown if the controller performs updates to the - // status before it has all the information it needs to be able to determine - // if the condition is true. - // - // Possible reasons for this condition to be True are: - // - // * "Programmed" - // - // Possible reasons for this condition to be False are: - // - // * "Invalid" - // * "Pending" - // * "NoResources" - // * "AddressNotAssigned" - // - // Possible reasons for this condition to be Unknown are: - // - // * "Pending" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - GatewayConditionProgrammed GatewayConditionType = "Programmed" - - // This reason is used with the "Programmed" condition when the condition is - // true. - GatewayReasonProgrammed GatewayConditionReason = "Programmed" - - // This reason is used with the "Programmed" and "Accepted" conditions when the Gateway is - // syntactically or semantically invalid. - GatewayReasonInvalid GatewayConditionReason = "Invalid" - - // This reason is used with the "Programmed" condition when the - // Gateway is not scheduled because insufficient infrastructure - // resources are available. - GatewayReasonNoResources GatewayConditionReason = "NoResources" - - // This reason is used with the "Programmed" condition when none of the requested - // addresses have been assigned to the Gateway. This reason can be used to - // express a range of circumstances, including (but not limited to) IPAM - // address exhaustion, address not yet allocated, or a named address not being found. - GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned" -) - -const ( - // This condition is true when the controller managing the Gateway is - // syntactically and semantically valid enough to produce some configuration - // in the underlying data plane. This does not indicate whether or not the - // configuration has been propagated to the data plane. - // - // Possible reasons for this condition to be True are: - // - // * "Accepted" - // * "ListenersNotValid" - // - // Possible reasons for this condition to be False are: - // - // * "Invalid" - // * "NotReconciled" - // * "UnsupportedAddress" - // * "ListenersNotValid" - // - // Possible reasons for this condition to be Unknown are: - // - // * "Pending" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - GatewayConditionAccepted GatewayConditionType = "Accepted" - - // This reason is used with the "Accepted" condition when the condition is - // True. - GatewayReasonAccepted GatewayConditionReason = "Accepted" - - // This reason is used with the "Accepted" condition when one or - // more Listeners have an invalid or unsupported configuration - // and cannot be configured on the Gateway. - // This can be the reason when "Accepted" is "True" or "False", depending on whether - // the listener being invalid causes the entire Gateway to not be accepted. - GatewayReasonListenersNotValid GatewayConditionReason = "ListenersNotValid" - - // This reason is used with the "Accepted" and "Programmed" - // conditions when the status is "Unknown" and no controller has reconciled - // the Gateway. - GatewayReasonPending GatewayConditionReason = "Pending" - - // This reason is used with the "Accepted" condition when the Gateway could not be configured - // because the requested address is not supported. This reason could be used in a number of - // instances, including: - // - // * The address is already in use. - // * The type of address is not supported by the implementation. - GatewayReasonUnsupportedAddress GatewayConditionReason = "UnsupportedAddress" -) - -const ( - // Deprecated: use "Accepted" instead. - GatewayConditionScheduled GatewayConditionType = "Scheduled" - - // This reason is used with the "Scheduled" condition when the condition is - // True. - // - // Deprecated: use the "Accepted" condition with reason "Accepted" instead. - GatewayReasonScheduled GatewayConditionReason = "Scheduled" - - // Deprecated: Use "Pending" instead. - GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled" -) - -const ( - // "Ready" is a condition type reserved for future use. It should not be used by implementations. - // - // If used in the future, "Ready" will represent the final state where all configuration is confirmed good - // _and has completely propagated to the data plane_. That is, it is a _guarantee_ that, as soon as something - // sees the Condition as `true`, then connections will be correctly routed _immediately_. - // - // This is a very strong guarantee, and to date no implementation has satisfied it enough to implement it. - // This reservation can be discussed in the future if necessary. - // - // Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters - // to alert about usage. - // Deprecated: Ready is reserved for future use - GatewayConditionReady GatewayConditionType = "Ready" - - // Deprecated: Ready is reserved for future use - GatewayReasonReady GatewayConditionReason = "Ready" - - // Deprecated: Ready is reserved for future use - GatewayReasonListenersNotReady GatewayConditionReason = "ListenersNotReady" -) +// +k8s:deepcopy-gen=false +type GatewayConditionReason = v1.GatewayConditionReason // ListenerStatus is the status associated with a Listener. -type ListenerStatus struct { - // Name is the name of the Listener that this status corresponds to. - Name SectionName `json:"name"` - - // SupportedKinds is the list indicating the Kinds supported by this - // listener. This MUST represent the kinds an implementation supports for - // that Listener configuration. - // - // If kinds are specified in Spec that are not supported, they MUST NOT - // appear in this list and an implementation MUST set the "ResolvedRefs" - // condition to "False" with the "InvalidRouteKinds" reason. If both valid - // and invalid Route kinds are specified, the implementation MUST - // reference the valid Route kinds that have been specified. - // - // +kubebuilder:validation:MaxItems=8 - SupportedKinds []RouteGroupKind `json:"supportedKinds"` - - // AttachedRoutes represents the total number of accepted Routes that have been - // successfully attached to this Listener. - AttachedRoutes int32 `json:"attachedRoutes"` - - // Conditions describe the current condition of this listener. - // - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - Conditions []metav1.Condition `json:"conditions"` -} +// +k8s:deepcopy-gen=false +type ListenerStatus = v1.ListenerStatus // ListenerConditionType is a type of condition associated with the // listener. This type should be used with the ListenerStatus.Conditions // field. -type ListenerConditionType string +// +k8s:deepcopy-gen=false +type ListenerConditionType = v1.ListenerConditionType // ListenerConditionReason defines the set of reasons that explain // why a particular Listener condition type has been raised. -type ListenerConditionReason string - -const ( - // This condition indicates that the controller was unable to resolve - // conflicting specification requirements for this Listener. If a - // Listener is conflicted, its network port should not be configured - // on any network elements. - // - // Possible reasons for this condition to be true are: - // - // * "HostnameConflict" - // * "ProtocolConflict" - // - // Possible reasons for this condition to be False are: - // - // * "NoConflicts" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionConflicted ListenerConditionType = "Conflicted" - - // This reason is used with the "Conflicted" condition when - // the Listener conflicts with hostnames in other Listeners. For - // example, this reason would be used when multiple Listeners on - // the same port use `example.com` in the hostname field. - ListenerReasonHostnameConflict ListenerConditionReason = "HostnameConflict" - - // This reason is used with the "Conflicted" condition when - // multiple Listeners are specified with the same Listener port - // number, but have conflicting protocol specifications. - ListenerReasonProtocolConflict ListenerConditionReason = "ProtocolConflict" - - // This reason is used with the "Conflicted" condition when the condition - // is False. - ListenerReasonNoConflicts ListenerConditionReason = "NoConflicts" -) - -const ( - // This condition indicates that the listener is syntactically and - // semantically valid, and that all features used in the listener's spec are - // supported. - // - // In general, a Listener will be marked as Accepted when the supplied - // configuration will generate at least some data plane configuration. - // - // For example, a Listener with an unsupported protocol will never generate - // any data plane config, and so will have Accepted set to `false.` - // Conversely, a Listener that does not have any Routes will be able to - // generate data plane config, and so will have Accepted set to `true`. - // - // Possible reasons for this condition to be True are: - // - // * "Accepted" - // - // Possible reasons for this condition to be False are: - // - // * "PortUnavailable" - // * "UnsupportedProtocol" - // - // Possible reasons for this condition to be Unknown are: - // - // * "Pending" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionAccepted ListenerConditionType = "Accepted" - - // Deprecated: use "Accepted" instead. - ListenerConditionDetached ListenerConditionType = "Detached" - - // This reason is used with the "Accepted" condition when the condition is - // True. - ListenerReasonAccepted ListenerConditionReason = "Accepted" - - // This reason is used with the "Detached" condition when the condition is - // False. - // - // Deprecated: use the "Accepted" condition with reason "Accepted" instead. - ListenerReasonAttached ListenerConditionReason = "Attached" - - // This reason is used with the "Accepted" condition when the Listener - // requests a port that cannot be used on the Gateway. This reason could be - // used in a number of instances, including: - // - // * The port is already in use. - // * The port is not supported by the implementation. - ListenerReasonPortUnavailable ListenerConditionReason = "PortUnavailable" - - // This reason is used with the "Accepted" condition when the - // Listener could not be attached to be Gateway because its - // protocol type is not supported. - ListenerReasonUnsupportedProtocol ListenerConditionReason = "UnsupportedProtocol" -) - -const ( - // This condition indicates whether the controller was able to - // resolve all the object references for the Listener. - // - // Possible reasons for this condition to be true are: - // - // * "ResolvedRefs" - // - // Possible reasons for this condition to be False are: - // - // * "InvalidCertificateRef" - // * "InvalidRouteKinds" - // * "RefNotPermitted" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionResolvedRefs ListenerConditionType = "ResolvedRefs" - - // This reason is used with the "ResolvedRefs" condition when the condition - // is true. - ListenerReasonResolvedRefs ListenerConditionReason = "ResolvedRefs" - - // This reason is used with the "ResolvedRefs" condition when the - // Listener has a TLS configuration with at least one TLS CertificateRef - // that is invalid or does not exist. - // A CertificateRef is considered invalid when it refers to a nonexistent - // or unsupported resource or kind, or when the data within that resource - // is malformed. - // This reason must be used only when the reference is allowed, either by - // referencing an object in the same namespace as the Gateway, or when - // a cross-namespace reference has been explicitly allowed by a ReferenceGrant. - // If the reference is not allowed, the reason RefNotPermitted must be used - // instead. - ListenerReasonInvalidCertificateRef ListenerConditionReason = "InvalidCertificateRef" - - // This reason is used with the "ResolvedRefs" condition when an invalid or - // unsupported Route kind is specified by the Listener. - ListenerReasonInvalidRouteKinds ListenerConditionReason = "InvalidRouteKinds" - - // This reason is used with the "ResolvedRefs" condition when the - // Listener has a TLS configuration that references an object in another - // namespace, where the object in the other namespace does not have a - // ReferenceGrant explicitly allowing the reference. - ListenerReasonRefNotPermitted ListenerConditionReason = "RefNotPermitted" -) - -const ( - // This condition indicates whether a Listener has generated some - // configuration that will soon be ready in the underlying data plane. - // - // It is a positive-polarity summary condition, and so should always be - // present on the resource with ObservedGeneration set. - // - // It should be set to Unknown if the controller performs updates to the - // status before it has all the information it needs to be able to determine - // if the condition is true. - // - // Possible reasons for this condition to be True are: - // - // * "Programmed" - // - // Possible reasons for this condition to be False are: - // - // * "Invalid" - // * "Pending" - // - // Possible reasons for this condition to be Unknown are: - // - // * "Pending" - // - // Controllers may raise this condition with other reasons, - // but should prefer to use the reasons listed above to improve - // interoperability. - ListenerConditionProgrammed ListenerConditionType = "Programmed" - - // This reason is used with the "Programmed" condition when the condition is - // true. - ListenerReasonProgrammed ListenerConditionReason = "Programmed" - - // This reason is used with the "Ready" and "Programmed" conditions when the - // Listener is syntactically or semantically invalid. - ListenerReasonInvalid ListenerConditionReason = "Invalid" - - // This reason is used with the "Accepted", "Ready" and "Programmed" - // conditions when the Listener is either not yet reconciled or not yet not - // online and ready to accept client traffic. - ListenerReasonPending ListenerConditionReason = "Pending" -) - -const ( - // "Ready" is a condition type reserved for future use. It should not be used by implementations. - // Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters - // to alert about usage. - // - // If used in the future, "Ready" will represent the final state where all configuration is confirmed good - // _and has completely propagated to the data plane_. That is, it is a _guarantee_ that, as soon as something - // sees the Condition as `true`, then connections will be correctly routed _immediately_. - // - // This is a very strong guarantee, and to date no implementation has satisfied it enough to implement it. - // This reservation can be discussed in the future if necessary. - // - // Deprecated: Ready is reserved for future use - ListenerConditionReady ListenerConditionType = "Ready" - - // Deprecated: Ready is reserved for future use - ListenerReasonReady ListenerConditionReason = "Ready" -) +// +k8s:deepcopy-gen=false +type ListenerConditionReason = v1.ListenerConditionReason diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gatewayclass_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gatewayclass_types.go index c2df77f90..f1b7ed8ae 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gatewayclass_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/gatewayclass_types.go @@ -18,6 +18,8 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient @@ -48,209 +50,37 @@ import ( // Gateway is not deleted while in use. // // GatewayClass is a Cluster level resource. -type GatewayClass struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` +type GatewayClass v1.GatewayClass - // Spec defines the desired state of GatewayClass. - Spec GatewayClassSpec `json:"spec"` +// +kubebuilder:object:root=true - // Status defines the current state of GatewayClass. - // - // Implementations MUST populate status on all GatewayClass resources which - // specify their controller name. - // - // +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}} - Status GatewayClassStatus `json:"status,omitempty"` +// GatewayClassList contains a list of GatewayClass +type GatewayClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []GatewayClass `json:"items"` } -const ( - // GatewayClassFinalizerGatewaysExist should be added as a finalizer to the - // GatewayClass whenever there are provisioned Gateways using a - // GatewayClass. - GatewayClassFinalizerGatewaysExist = "gateway-exists-finalizer.gateway.networking.k8s.io" -) - // GatewayClassSpec reflects the configuration of a class of Gateways. -type GatewayClassSpec struct { - // ControllerName is the name of the controller that is managing Gateways of - // this class. The value of this field MUST be a domain prefixed path. - // - // Example: "example.net/gateway-controller". - // - // This field is not mutable and cannot be empty. - // - // Support: Core - // - // +kubebuilder:validation:XValidation:message="Value is immutable",rule="self == oldSelf" - ControllerName GatewayController `json:"controllerName"` - - // ParametersRef is a reference to a resource that contains the configuration - // parameters corresponding to the GatewayClass. This is optional if the - // controller does not require any additional configuration. - // - // ParametersRef can reference a standard Kubernetes resource, i.e. ConfigMap, - // or an implementation-specific custom resource. The resource can be - // cluster-scoped or namespace-scoped. - // - // If the referent cannot be found, the GatewayClass's "InvalidParameters" - // status condition will be true. - // - // Support: Implementation-specific - // - // +optional - ParametersRef *ParametersReference `json:"parametersRef,omitempty"` - - // Description helps describe a GatewayClass with more details. - // - // +kubebuilder:validation:MaxLength=64 - // +optional - Description *string `json:"description,omitempty"` -} +// +k8s:deepcopy-gen=false +type GatewayClassSpec = v1.GatewayClassSpec // ParametersReference identifies an API object containing controller-specific // configuration resource within the cluster. -type ParametersReference struct { - // Group is the group of the referent. - Group Group `json:"group"` - - // Kind is kind of the referent. - Kind Kind `json:"kind"` - - // Name is the name of the referent. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=253 - Name string `json:"name"` - - // Namespace is the namespace of the referent. - // This field is required when referring to a Namespace-scoped resource and - // MUST be unset when referring to a Cluster-scoped resource. - // - // +optional - Namespace *Namespace `json:"namespace,omitempty"` -} +// +k8s:deepcopy-gen=false +type ParametersReference = v1.ParametersReference // GatewayClassConditionType is the type for status conditions on // Gateway resources. This type should be used with the // GatewayClassStatus.Conditions field. -type GatewayClassConditionType string +// +k8s:deepcopy-gen=false +type GatewayClassConditionType = v1.GatewayClassConditionType // GatewayClassConditionReason defines the set of reasons that explain why a // particular GatewayClass condition type has been raised. -type GatewayClassConditionReason string - -const ( - // This condition indicates whether the GatewayClass has been accepted by - // the controller requested in the `spec.controller` field. - // - // This condition defaults to Unknown, and MUST be set by a controller when - // it sees a GatewayClass using its controller string. The status of this - // condition MUST be set to True if the controller will support provisioning - // Gateways using this class. Otherwise, this status MUST be set to False. - // If the status is set to False, the controller SHOULD set a Message and - // Reason as an explanation. - // - // Possible reasons for this condition to be true are: - // - // * "Accepted" - // - // Possible reasons for this condition to be False are: - // - // * "InvalidParameters" - // * "UnsupportedVersion" - // - // Possible reasons for this condition to be Unknown are: - // - // * "Pending" - // - // Controllers should prefer to use the values of GatewayClassConditionReason - // for the corresponding Reason, where appropriate. - GatewayClassConditionStatusAccepted GatewayClassConditionType = "Accepted" - - // This reason is used with the "Accepted" condition when the condition is - // true. - GatewayClassReasonAccepted GatewayClassConditionReason = "Accepted" - - // This reason is used with the "Accepted" condition when the - // GatewayClass was not accepted because the parametersRef field - // was invalid, with more detail in the message. - GatewayClassReasonInvalidParameters GatewayClassConditionReason = "InvalidParameters" - - // This reason is used with the "Accepted" condition when the - // requested controller has not yet made a decision about whether - // to admit the GatewayClass. It is the default Reason on a new - // GatewayClass. - GatewayClassReasonPending GatewayClassConditionReason = "Pending" - - // Deprecated: Use "Pending" instead. - GatewayClassReasonWaiting GatewayClassConditionReason = "Waiting" -) - -const ( - // This condition indicates whether the GatewayClass supports the version(s) - // of Gateway API CRDs present in the cluster. This condition MUST be set by - // a controller when it marks a GatewayClass "Accepted". - // - // The version of a Gateway API CRD is defined by the - // gateway.networking.k8s.io/bundle-version annotation on the CRD. If - // implementations detect any Gateway API CRDs that either do not have this - // annotation set, or have it set to a version that is not recognized or - // supported by the implementation, this condition MUST be set to false. - // - // Implementations MAY choose to either provide "best effort" support when - // an unrecognized CRD version is present. This would be communicated by - // setting the "Accepted" condition to true and the "SupportedVersion" - // condition to false. - // - // Alternatively, implementations MAY choose not to support CRDs with - // unrecognized versions. This would be communicated by setting the - // "Accepted" condition to false with the reason "UnsupportedVersions". - // - // Possible reasons for this condition to be true are: - // - // * "SupportedVersion" - // - // Possible reasons for this condition to be False are: - // - // * "UnsupportedVersion" - // - // Controllers should prefer to use the values of GatewayClassConditionReason - // for the corresponding Reason, where appropriate. - GatewayClassConditionStatusSupportedVersion GatewayClassConditionType = "SupportedVersion" - - // This reason is used with the "SupportedVersion" condition when the - // condition is true. - GatewayClassReasonSupportedVersion GatewayClassConditionReason = "SupportedVersion" - - // This reason is used with the "SupportedVersion" or "Accepted" condition - // when the condition is false. A message SHOULD be included in this - // condition that includes the detected CRD version(s) present in the - // cluster and the CRD version(s) that are supported by the GatewayClass. - GatewayClassReasonUnsupportedVersion GatewayClassConditionReason = "UnsupportedVersion" -) +// +k8s:deepcopy-gen=false +type GatewayClassConditionReason = v1.GatewayClassConditionReason // GatewayClassStatus is the current status for the GatewayClass. -type GatewayClassStatus struct { - // Conditions is the current status from the controller for - // this GatewayClass. - // - // Controllers should prefer to publish conditions using values - // of GatewayClassConditionType for the type of each Condition. - // - // +optional - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MaxItems=8 - // +kubebuilder:default={{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Pending", lastTransitionTime: "1970-01-01T00:00:00Z"}} - Conditions []metav1.Condition `json:"conditions,omitempty"` -} - -// +kubebuilder:object:root=true - -// GatewayClassList contains a list of GatewayClass -type GatewayClassList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []GatewayClass `json:"items"` -} +// +k8s:deepcopy-gen=false +type GatewayClassStatus = v1.GatewayClassStatus diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/httproute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/httproute_types.go index fb6809ddb..1d869e09b 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/httproute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/httproute_types.go @@ -18,6 +18,8 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + v1 "sigs.k8s.io/gateway-api/apis/v1" ) // +genclient @@ -32,16 +34,7 @@ import ( // to match requests by hostname, path, header, or query param. Filters can be // used to specify additional processing steps. Backends specify where matching // requests should be routed. -type HTTPRoute struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of HTTPRoute. - Spec HTTPRouteSpec `json:"spec"` - - // Status defines the current state of HTTPRoute. - Status HTTPRouteStatus `json:"status,omitempty"` -} +type HTTPRoute v1.HTTPRoute // +kubebuilder:object:root=true @@ -53,271 +46,17 @@ type HTTPRouteList struct { } // HTTPRouteSpec defines the desired state of HTTPRoute -type HTTPRouteSpec struct { - CommonRouteSpec `json:",inline"` - - // Hostnames defines a set of hostnames that should match against the HTTP Host - // header to select a HTTPRoute used to process the request. Implementations - // MUST ignore any port value specified in the HTTP Host header while - // performing a match and (absent of any applicable header modification - // configuration) MUST forward this header unmodified to the backend. - // - // Valid values for Hostnames are determined by RFC 1123 definition of a - // hostname with 2 notable exceptions: - // - // 1. IPs are not allowed. - // 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard - // label must appear by itself as the first label. - // - // If a hostname is specified by both the Listener and HTTPRoute, there - // must be at least one intersecting hostname for the HTTPRoute to be - // attached to the Listener. For example: - // - // * A Listener with `test.example.com` as the hostname matches HTTPRoutes - // that have either not specified any hostnames, or have specified at - // least one of `test.example.com` or `*.example.com`. - // * A Listener with `*.example.com` as the hostname matches HTTPRoutes - // that have either not specified any hostnames or have specified at least - // one hostname that matches the Listener hostname. For example, - // `*.example.com`, `test.example.com`, and `foo.test.example.com` would - // all match. On the other hand, `example.com` and `test.example.net` would - // not match. - // - // Hostnames that are prefixed with a wildcard label (`*.`) are interpreted - // as a suffix match. That means that a match for `*.example.com` would match - // both `test.example.com`, and `foo.test.example.com`, but not `example.com`. - // - // If both the Listener and HTTPRoute have specified hostnames, any - // HTTPRoute hostnames that do not match the Listener hostname MUST be - // ignored. For example, if a Listener specified `*.example.com`, and the - // HTTPRoute specified `test.example.com` and `test.example.net`, - // `test.example.net` must not be considered for a match. - // - // If both the Listener and HTTPRoute have specified hostnames, and none - // match with the criteria above, then the HTTPRoute is not accepted. The - // implementation must raise an 'Accepted' Condition with a status of - // `False` in the corresponding RouteParentStatus. - // - // In the event that multiple HTTPRoutes specify intersecting hostnames (e.g. - // overlapping wildcard matching and exact matching hostnames), precedence must - // be given to rules from the HTTPRoute with the largest number of: - // - // * Characters in a matching non-wildcard hostname. - // * Characters in a matching hostname. - // - // If ties exist across multiple Routes, the matching precedence rules for - // HTTPRouteMatches takes over. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - Hostnames []Hostname `json:"hostnames,omitempty"` - - // Rules are a list of HTTP matchers, filters and actions. - // - // +optional - // +kubebuilder:validation:MaxItems=16 - // +kubebuilder:default={{matches: {{path: {type: "PathPrefix", value: "/"}}}}} - Rules []HTTPRouteRule `json:"rules,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPRouteSpec = v1.HTTPRouteSpec // HTTPRouteRule defines semantics for matching an HTTP request based on // conditions (matches), processing it (filters), and forwarding the request to // an API object (backendRefs). -// -// +kubebuilder:validation:XValidation:message="RequestRedirect filter must not be used together with backendRefs",rule="(has(self.backendRefs) && size(self.backendRefs) > 0) ? (!has(self.filters) || self.filters.all(f, !has(f.requestRedirect))): true" -// +kubebuilder:validation:XValidation:message="When using RequestRedirect filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.filters) && self.filters.exists_one(f, has(f.requestRedirect) && has(f.requestRedirect.path) && f.requestRedirect.path.type == 'ReplacePrefixMatch' && has(f.requestRedirect.path.replacePrefixMatch))) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" -// +kubebuilder:validation:XValidation:message="When using URLRewrite filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.filters) && self.filters.exists_one(f, has(f.urlRewrite) && has(f.urlRewrite.path) && f.urlRewrite.path.type == 'ReplacePrefixMatch' && has(f.urlRewrite.path.replacePrefixMatch))) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" -// +kubebuilder:validation:XValidation:message="Within backendRefs, when using RequestRedirect filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.requestRedirect) && has(f.requestRedirect.path) && f.requestRedirect.path.type == 'ReplacePrefixMatch' && has(f.requestRedirect.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" -// +kubebuilder:validation:XValidation:message="Within backendRefs, When using URLRewrite filter with path.replacePrefixMatch, exactly one PathPrefix match must be specified",rule="(has(self.backendRefs) && self.backendRefs.exists_one(b, (has(b.filters) && b.filters.exists_one(f, has(f.urlRewrite) && has(f.urlRewrite.path) && f.urlRewrite.path.type == 'ReplacePrefixMatch' && has(f.urlRewrite.path.replacePrefixMatch))) )) ? ((size(self.matches) != 1 || !has(self.matches[0].path) || self.matches[0].path.type != 'PathPrefix') ? false : true) : true" -type HTTPRouteRule struct { - // Matches define conditions used for matching the rule against incoming - // HTTP requests. Each match is independent, i.e. this rule will be matched - // if **any** one of the matches is satisfied. - // - // For example, take the following matches configuration: - // - // ``` - // matches: - // - path: - // value: "/foo" - // headers: - // - name: "version" - // value: "v2" - // - path: - // value: "/v2/foo" - // ``` - // - // For a request to match against this rule, a request must satisfy - // EITHER of the two conditions: - // - // - path prefixed with `/foo` AND contains the header `version: v2` - // - path prefix of `/v2/foo` - // - // See the documentation for HTTPRouteMatch on how to specify multiple - // match conditions that should be ANDed together. - // - // If no matches are specified, the default is a prefix - // path match on "/", which has the effect of matching every - // HTTP request. - // - // Proxy or Load Balancer routing configuration generated from HTTPRoutes - // MUST prioritize matches based on the following criteria, continuing on - // ties. Across all rules specified on applicable Routes, precedence must be - // given to the match having: - // - // * "Exact" path match. - // * "Prefix" path match with largest number of characters. - // * Method match. - // * Largest number of header matches. - // * Largest number of query param matches. - // - // Note: The precedence of RegularExpression path matches are implementation-specific. - // - // If ties still exist across multiple Routes, matching precedence MUST be - // determined in order of the following criteria, continuing on ties: - // - // * The oldest Route based on creation timestamp. - // * The Route appearing first in alphabetical order by - // "{namespace}/{name}". - // - // If ties still exist within an HTTPRoute, matching precedence MUST be granted - // to the FIRST matching rule (in list order) with a match meeting the above - // criteria. - // - // When no rules matching a request have been successfully attached to the - // parent a request is coming from, a HTTP 404 status code MUST be returned. - // - // +optional - // +kubebuilder:validation:MaxItems=8 - // +kubebuilder:default={{path:{ type: "PathPrefix", value: "/"}}} - Matches []HTTPRouteMatch `json:"matches,omitempty"` - - // Filters define the filters that are applied to requests that match - // this rule. - // - // The effects of ordering of multiple behaviors are currently unspecified. - // This can change in the future based on feedback during the alpha stage. - // - // Conformance-levels at this level are defined based on the type of filter: - // - // - ALL core filters MUST be supported by all implementations. - // - Implementers are encouraged to support extended filters. - // - Implementation-specific custom filters have no API guarantees across - // implementations. - // - // Specifying the same filter multiple times is not supported unless explicitly - // indicated in the filter. - // - // All filters are expected to be compatible with each other except for the - // URLRewrite and RequestRedirect filters, which may not be combined. If an - // implementation can not support other combinations of filters, they must clearly - // document that limitation. In cases where incompatible or unsupported - // filters are specified and cause the `Accepted` condition to be set to status - // `False`, implementations may use the `IncompatibleFilters` reason to specify - // this configuration error. - // - // Support: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - // +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))" - // +kubebuilder:validation:XValidation:message="RequestHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'RequestHeaderModifier').size() <= 1" - // +kubebuilder:validation:XValidation:message="ResponseHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'ResponseHeaderModifier').size() <= 1" - // +kubebuilder:validation:XValidation:message="RequestRedirect filter cannot be repeated",rule="self.filter(f, f.type == 'RequestRedirect').size() <= 1" - // +kubebuilder:validation:XValidation:message="URLRewrite filter cannot be repeated",rule="self.filter(f, f.type == 'URLRewrite').size() <= 1" - Filters []HTTPRouteFilter `json:"filters,omitempty"` - - // BackendRefs defines the backend(s) where matching requests should be - // sent. - // - // Failure behavior here depends on how many BackendRefs are specified and - // how many are invalid. - // - // If *all* entries in BackendRefs are invalid, and there are also no filters - // specified in this route rule, *all* traffic which matches this rule MUST - // receive a 500 status code. - // - // See the HTTPBackendRef definition for the rules about what makes a single - // HTTPBackendRef invalid. - // - // When a HTTPBackendRef is invalid, 500 status codes MUST be returned for - // requests that would have otherwise been routed to an invalid backend. If - // multiple backends are specified, and some are invalid, the proportion of - // requests that would otherwise have been routed to an invalid backend - // MUST receive a 500 status code. - // - // For example, if two backends are specified with equal weights, and one is - // invalid, 50 percent of traffic must receive a 500. Implementations may - // choose how that 50 percent is determined. - // - // Support: Core for Kubernetes Service - // - // Support: Extended for Kubernetes ServiceImport - // - // Support: Implementation-specific for any other resource - // - // Support for weight: Core - // - // +optional - // +kubebuilder:validation:MaxItems=16 - BackendRefs []HTTPBackendRef `json:"backendRefs,omitempty"` - - // Timeouts defines the timeouts that can be configured for an HTTP request. - // - // Support: Extended - // - // +optional - // - Timeouts *HTTPRouteTimeouts `json:"timeouts,omitempty"` -} - -// HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute. -// Timeout values are represented with Gateway API Duration formatting. -// Specifying a zero value such as "0s" is interpreted as no timeout. -// -// +kubebuilder:validation:XValidation:message="backendRequest timeout cannot be longer than request timeout",rule="!(has(self.request) && has(self.backendRequest) && duration(self.request) != duration('0s') && duration(self.backendRequest) > duration(self.request))" -type HTTPRouteTimeouts struct { - // Request specifies the maximum duration for a gateway to respond to an HTTP request. - // If the gateway has not been able to respond before this deadline is met, the gateway - // MUST return a timeout error. - // - // For example, setting the `rules.timeouts.request` field to the value `10s` in an - // `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds - // to complete. - // - // This timeout is intended to cover as close to the whole request-response transaction - // as possible although an implementation MAY choose to start the timeout after the entire - // request stream has been received instead of immediately after the transaction is - // initiated by the client. - // - // When this field is unspecified, request timeout behavior is implementation-specific. - // - // Support: Extended - // - // +optional - Request *Duration `json:"request,omitempty"` - - // BackendRequest specifies a timeout for an individual request from the gateway - // to a backend. This covers the time from when the request first starts being - // sent from the gateway to when the full response has been received from the backend. - // - // An entire client HTTP transaction with a gateway, covered by the Request timeout, - // may result in more than one call from the gateway to the destination backend, - // for example, if automatic retries are supported. - // - // Because the Request timeout encompasses the BackendRequest timeout, the value of - // BackendRequest must be <= the value of Request timeout. - // - // Support: Extended - // - // +optional - BackendRequest *Duration `json:"backendRequest,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPRouteRule = v1.HTTPRouteRule // PathMatchType specifies the semantics of how HTTP paths should be compared. -// Valid PathMatchType values, along with their support levels, are: +// Valid PathMatchType values, along with their conformance level, are: // // * "Exact" - Core // * "PathPrefix" - Core @@ -336,68 +75,12 @@ type HTTPRouteTimeouts struct { // Reason of `UnsupportedValue`. // // +kubebuilder:validation:Enum=Exact;PathPrefix;RegularExpression -type PathMatchType string - -const ( - // Matches the URL path exactly and with case sensitivity. This means that - // an exact path match on `/abc` will only match requests to `/abc`, NOT - // `/abc/`, `/Abc`, or `/abcd`. - PathMatchExact PathMatchType = "Exact" - - // 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. When specified, a trailing `/` is ignored. - // - // For example, the paths `/abc`, `/abc/`, and `/abc/def` would all match - // the prefix `/abc`, but the path `/abcd` would not. - // - // "PathPrefix" is semantically equivalent to the "Prefix" path type in the - // Kubernetes Ingress API. - PathMatchPathPrefix PathMatchType = "PathPrefix" - - // Matches if the URL path matches the given regular expression with - // case sensitivity. - // - // Since `"RegularExpression"` has implementation-specific conformance, - // implementations can support POSIX, PCRE, RE2 or any other regular expression - // dialect. - // Please read the implementation's documentation to determine the supported - // dialect. - PathMatchRegularExpression PathMatchType = "RegularExpression" -) +// +k8s:deepcopy-gen=false +type PathMatchType = v1.PathMatchType // HTTPPathMatch describes how to select a HTTP route by matching the HTTP request path. -// -// +kubebuilder:validation:XValidation:message="value must be an absolute path and start with '/' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? self.value.startsWith('/') : true" -// +kubebuilder:validation:XValidation:message="must not contain '//' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('//') : true" -// +kubebuilder:validation:XValidation:message="must not contain '/./' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('/./') : true" -// +kubebuilder:validation:XValidation:message="must not contain '/../' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('/../') : true" -// +kubebuilder:validation:XValidation:message="must not contain '%2f' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('%2f') : true" -// +kubebuilder:validation:XValidation:message="must not contain '%2F' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('%2F') : true" -// +kubebuilder:validation:XValidation:message="must not contain '#' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.contains('#') : true" -// +kubebuilder:validation:XValidation:message="must not end with '/..' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.endsWith('/..') : true" -// +kubebuilder:validation:XValidation:message="must not end with '/.' when type one of ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? !self.value.endsWith('/.') : true" -// +kubebuilder:validation:XValidation:message="type must be one of ['Exact', 'PathPrefix', 'RegularExpression']",rule="self.type in ['Exact','PathPrefix'] || self.type == 'RegularExpression'" -// +kubebuilder:validation:XValidation:message="must only contain valid characters (matching ^(?:[-A-Za-z0-9/._~!$&'()*+,;=:@]|[%][0-9a-fA-F]{2})+$) for types ['Exact', 'PathPrefix']",rule="(self.type in ['Exact','PathPrefix']) ? self.value.matches(r\"\"\"^(?:[-A-Za-z0-9/._~!$&'()*+,;=:@]|[%][0-9a-fA-F]{2})+$\"\"\") : true" -type HTTPPathMatch struct { - // Type specifies how to match against the path Value. - // - // Support: Core (Exact, PathPrefix) - // - // Support: Implementation-specific (RegularExpression) - // - // +optional - // +kubebuilder:default=PathPrefix - Type *PathMatchType `json:"type,omitempty"` - - // Value of the HTTP path to match against. - // - // +optional - // +kubebuilder:default="/" - // +kubebuilder:validation:MaxLength=1024 - Value *string `json:"value,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPPathMatch = v1.HTTPPathMatch // HeaderMatchType specifies the semantics of how HTTP header values should be // compared. Valid HeaderMatchType values, along with their conformance levels, are: @@ -413,18 +96,12 @@ type HTTPPathMatch struct { // Reason of `UnsupportedValue`. // // +kubebuilder:validation:Enum=Exact;RegularExpression -type HeaderMatchType string - -// HeaderMatchType constants. -const ( - HeaderMatchExact HeaderMatchType = "Exact" - HeaderMatchRegularExpression HeaderMatchType = "RegularExpression" -) +// +k8s:deepcopy-gen=false +type HeaderMatchType = v1.HeaderMatchType // HTTPHeaderName is the name of an HTTP header. // // Valid values include: -// // * "Authorization" // * "Set-Cookie" // @@ -432,49 +109,15 @@ const ( // // - ":method" - ":" is an invalid character. This means that HTTP/2 pseudo // headers are not currently supported by this type. -// - "/invalid" - "/ " is an invalid character -type HTTPHeaderName HeaderName +// +// * "/invalid" - "/" is an invalid character +// +k8s:deepcopy-gen=false +type HTTPHeaderName = v1.HeaderName // HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request // headers. -type HTTPHeaderMatch struct { - // Type specifies how to match against the value of the header. - // - // Support: Core (Exact) - // - // Support: Implementation-specific (RegularExpression) - // - // Since RegularExpression HeaderMatchType has implementation-specific - // conformance, implementations can support POSIX, PCRE or any other dialects - // of regular expressions. Please read the implementation's documentation to - // determine the supported dialect. - // - // +optional - // +kubebuilder:default=Exact - Type *HeaderMatchType `json:"type,omitempty"` - - // Name is the name of the HTTP Header to be matched. Name matching MUST be - // case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). - // - // If multiple entries specify equivalent header names, only the first - // entry with an equivalent name MUST be considered for a match. Subsequent - // entries with an equivalent header name MUST be ignored. Due to the - // case-insensitivity of header names, "foo" and "Foo" are considered - // equivalent. - // - // When a header is repeated in an HTTP request, it is - // implementation-specific behavior as to how this is represented. - // Generally, proxies should follow the guidance from the RFC: - // https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding - // processing a repeated header, with special handling for "Set-Cookie". - Name HTTPHeaderName `json:"name"` - - // Value is the value of HTTP Header to be matched. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=4096 - Value string `json:"value"` -} +// +k8s:deepcopy-gen=false +type HTTPHeaderMatch = v1.HTTPHeaderMatch // QueryParamMatchType specifies the semantics of how HTTP query parameter // values should be compared. Valid QueryParamMatchType values, along with their @@ -491,57 +134,13 @@ type HTTPHeaderMatch struct { // Reason of `UnsupportedValue`. // // +kubebuilder:validation:Enum=Exact;RegularExpression -type QueryParamMatchType string - -// QueryParamMatchType constants. -const ( - QueryParamMatchExact QueryParamMatchType = "Exact" - QueryParamMatchRegularExpression QueryParamMatchType = "RegularExpression" -) +// +k8s:deepcopy-gen=false +type QueryParamMatchType = v1.QueryParamMatchType // HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP // query parameters. -type HTTPQueryParamMatch struct { - // Type specifies how to match against the value of the query parameter. - // - // Support: Extended (Exact) - // - // Support: Implementation-specific (RegularExpression) - // - // Since RegularExpression QueryParamMatchType has Implementation-specific - // conformance, implementations can support POSIX, PCRE or any other - // dialects of regular expressions. Please read the implementation's - // documentation to determine the supported dialect. - // - // +optional - // +kubebuilder:default=Exact - Type *QueryParamMatchType `json:"type,omitempty"` - - // Name is the name of the HTTP query param to be matched. This must be an - // exact string match. (See - // https://tools.ietf.org/html/rfc7230#section-2.7.3). - // - // If multiple entries specify equivalent query param names, only the first - // entry with an equivalent name MUST be considered for a match. Subsequent - // entries with an equivalent query param name MUST be ignored. - // - // If a query param is repeated in an HTTP request, the behavior is - // purposely left undefined, since different data planes have different - // capabilities. However, it is *recommended* that implementations should - // match against the first value of the param if the data plane supports it, - // as this behavior is expected in other load balancing contexts outside of - // the Gateway API. - // - // Users SHOULD NOT route traffic based on repeated query params to guard - // themselves against potential differences in the implementations. - Name HTTPHeaderName `json:"name"` - - // Value is the value of HTTP query param to be matched. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=1024 - Value string `json:"value"` -} +// +k8s:deepcopy-gen=false +type HTTPQueryParamMatch = v1.HTTPQueryParamMatch // HTTPMethod describes how to select a HTTP route by matching the HTTP // method as defined by @@ -557,19 +156,8 @@ type HTTPQueryParamMatch struct { // Reason of `UnsupportedValue`. // // +kubebuilder:validation:Enum=GET;HEAD;POST;PUT;DELETE;CONNECT;OPTIONS;TRACE;PATCH -type HTTPMethod string - -const ( - HTTPMethodGet HTTPMethod = "GET" - HTTPMethodHead HTTPMethod = "HEAD" - HTTPMethodPost HTTPMethod = "POST" - HTTPMethodPut HTTPMethod = "PUT" - HTTPMethodDelete HTTPMethod = "DELETE" - HTTPMethodConnect HTTPMethod = "CONNECT" - HTTPMethodOptions HTTPMethod = "OPTIONS" - HTTPMethodTrace HTTPMethod = "TRACE" - HTTPMethodPatch HTTPMethod = "PATCH" -) +// +k8s:deepcopy-gen=false +type HTTPMethod = v1.HTTPMethod // HTTPRouteMatch defines the predicate used to match requests to a given // action. Multiple match types are ANDed together, i.e. the match will @@ -588,45 +176,8 @@ const ( // value "v1" // // ``` -type HTTPRouteMatch struct { - // Path specifies a HTTP request path matcher. If this field is not - // specified, a default prefix match on the "/" path is provided. - // - // +optional - // +kubebuilder:default={type: "PathPrefix", value: "/"} - Path *HTTPPathMatch `json:"path,omitempty"` - - // Headers specifies HTTP request header matchers. Multiple match values are - // ANDed together, meaning, a request must match all the specified headers - // to select the route. - // - // +listType=map - // +listMapKey=name - // +optional - // +kubebuilder:validation:MaxItems=16 - Headers []HTTPHeaderMatch `json:"headers,omitempty"` - - // QueryParams specifies HTTP query parameter matchers. Multiple match - // values are ANDed together, meaning, a request must match all the - // specified query parameters to select the route. - // - // Support: Extended - // - // +listType=map - // +listMapKey=name - // +optional - // +kubebuilder:validation:MaxItems=16 - QueryParams []HTTPQueryParamMatch `json:"queryParams,omitempty"` - - // Method specifies HTTP method matcher. - // When specified, this route will be matched only if the request has the - // specified method. - // - // Support: Extended - // - // +optional - Method *HTTPMethod `json:"method,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPRouteMatch = v1.HTTPRouteMatch // HTTPRouteFilter defines processing steps that must be completed during the // request or response lifecycle. HTTPRouteFilters are meant as an extension @@ -634,533 +185,58 @@ type HTTPRouteMatch struct { // examples include request or response modification, implementing // authentication strategies, rate-limiting, and traffic shaping. API // guarantee/conformance is defined based on the type of the filter. -// -// +kubebuilder:validation:XValidation:message="filter.requestHeaderModifier must be nil if the filter.type is not RequestHeaderModifier",rule="!(has(self.requestHeaderModifier) && self.type != 'RequestHeaderModifier')" -// +kubebuilder:validation:XValidation:message="filter.requestHeaderModifier must be specified for RequestHeaderModifier filter.type",rule="!(!has(self.requestHeaderModifier) && self.type == 'RequestHeaderModifier')" -// +kubebuilder:validation:XValidation:message="filter.responseHeaderModifier must be nil if the filter.type is not ResponseHeaderModifier",rule="!(has(self.responseHeaderModifier) && self.type != 'ResponseHeaderModifier')" -// +kubebuilder:validation:XValidation:message="filter.responseHeaderModifier must be specified for ResponseHeaderModifier filter.type",rule="!(!has(self.responseHeaderModifier) && self.type == 'ResponseHeaderModifier')" -// +kubebuilder:validation:XValidation:message="filter.requestMirror must be nil if the filter.type is not RequestMirror",rule="!(has(self.requestMirror) && self.type != 'RequestMirror')" -// +kubebuilder:validation:XValidation:message="filter.requestMirror must be specified for RequestMirror filter.type",rule="!(!has(self.requestMirror) && self.type == 'RequestMirror')" -// +kubebuilder:validation:XValidation:message="filter.requestRedirect must be nil if the filter.type is not RequestRedirect",rule="!(has(self.requestRedirect) && self.type != 'RequestRedirect')" -// +kubebuilder:validation:XValidation:message="filter.requestRedirect must be specified for RequestRedirect filter.type",rule="!(!has(self.requestRedirect) && self.type == 'RequestRedirect')" -// +kubebuilder:validation:XValidation:message="filter.urlRewrite must be nil if the filter.type is not URLRewrite",rule="!(has(self.urlRewrite) && self.type != 'URLRewrite')" -// +kubebuilder:validation:XValidation:message="filter.urlRewrite must be specified for URLRewrite filter.type",rule="!(!has(self.urlRewrite) && self.type == 'URLRewrite')" -// +kubebuilder:validation:XValidation:message="filter.extensionRef must be nil if the filter.type is not ExtensionRef",rule="!(has(self.extensionRef) && self.type != 'ExtensionRef')" -// +kubebuilder:validation:XValidation:message="filter.extensionRef must be specified for ExtensionRef filter.type",rule="!(!has(self.extensionRef) && self.type == 'ExtensionRef')" -type HTTPRouteFilter struct { - // Type identifies the type of filter to apply. As with other API fields, - // types are classified into three conformance levels: - // - // - Core: Filter types and their corresponding configuration defined by - // "Support: Core" in this package, e.g. "RequestHeaderModifier". All - // implementations must support core filters. - // - // - Extended: Filter types and their corresponding configuration defined by - // "Support: Extended" in this package, e.g. "RequestMirror". Implementers - // are encouraged to support extended filters. - // - // - Implementation-specific: Filters that are defined and supported by - // specific vendors. - // In the future, filters showing convergence in behavior across multiple - // implementations will be considered for inclusion in extended or core - // conformance levels. Filter-specific configuration for such filters - // is specified using the ExtensionRef field. `Type` should be set to - // "ExtensionRef" for custom filters. - // - // Implementers are encouraged to define custom implementation types to - // extend the core API with implementation-specific behavior. - // - // If a reference to a custom filter type cannot be resolved, the filter - // MUST NOT be skipped. Instead, requests that would have been processed by - // that filter MUST receive a HTTP error response. - // - // Note that values may be added to this enum, implementations - // must ensure that unknown values will not cause a crash. - // - // Unknown values here must result in the implementation setting the - // Accepted Condition for the Route to `status: False`, with a - // Reason of `UnsupportedValue`. - // - // +unionDiscriminator - // +kubebuilder:validation:Enum=RequestHeaderModifier;ResponseHeaderModifier;RequestMirror;RequestRedirect;URLRewrite;ExtensionRef - Type HTTPRouteFilterType `json:"type"` - - // RequestHeaderModifier defines a schema for a filter that modifies request - // headers. - // - // Support: Core - // - // +optional - RequestHeaderModifier *HTTPHeaderFilter `json:"requestHeaderModifier,omitempty"` - - // ResponseHeaderModifier defines a schema for a filter that modifies response - // headers. - // - // Support: Extended - // - // +optional - ResponseHeaderModifier *HTTPHeaderFilter `json:"responseHeaderModifier,omitempty"` - - // RequestMirror defines a schema for a filter that mirrors requests. - // Requests are sent to the specified destination, but responses from - // that destination are ignored. - // - // This filter can be used multiple times within the same rule. Note that - // not all implementations will be able to support mirroring to multiple - // backends. - // - // Support: Extended - // - // +optional - RequestMirror *HTTPRequestMirrorFilter `json:"requestMirror,omitempty"` - - // RequestRedirect defines a schema for a filter that responds to the - // request with an HTTP redirection. - // - // Support: Core - // - // +optional - RequestRedirect *HTTPRequestRedirectFilter `json:"requestRedirect,omitempty"` - - // URLRewrite defines a schema for a filter that modifies a request during forwarding. - // - // Support: Extended - // - // +optional - URLRewrite *HTTPURLRewriteFilter `json:"urlRewrite,omitempty"` - - // ExtensionRef is an optional, implementation-specific extension to the - // "filter" behavior. For example, resource "myroutefilter" in group - // "networking.example.net"). ExtensionRef MUST NOT be used for core and - // extended filters. - // - // This filter can be used multiple times within the same rule. - // - // Support: Implementation-specific - // - // +optional - ExtensionRef *LocalObjectReference `json:"extensionRef,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPRouteFilter = v1.HTTPRouteFilter // HTTPRouteFilterType identifies a type of HTTPRoute filter. -type HTTPRouteFilterType string - -const ( - // HTTPRouteFilterRequestHeaderModifier can be used to add or remove an HTTP - // header from an HTTP request before it is sent to the upstream target. - // - // Support in HTTPRouteRule: Core - // - // Support in HTTPBackendRef: Extended - HTTPRouteFilterRequestHeaderModifier HTTPRouteFilterType = "RequestHeaderModifier" +// +k8s:deepcopy-gen=false +type HTTPRouteFilterType = v1.HTTPRouteFilterType - // HTTPRouteFilterResponseHeaderModifier can be used to add or remove an HTTP - // header from an HTTP response before it is sent to the client. - // - // Support in HTTPRouteRule: Extended - // - // Support in HTTPBackendRef: Extended - HTTPRouteFilterResponseHeaderModifier HTTPRouteFilterType = "ResponseHeaderModifier" - - // HTTPRouteFilterRequestRedirect can be used to redirect a request to - // another location. This filter can also be used for HTTP to HTTPS - // redirects. This may not be used on the same Route rule or BackendRef as a - // URLRewrite filter. - // - // Support in HTTPRouteRule: Core - // - // Support in HTTPBackendRef: Extended - HTTPRouteFilterRequestRedirect HTTPRouteFilterType = "RequestRedirect" - - // HTTPRouteFilterURLRewrite can be used to modify a request during - // forwarding. At most one of these filters may be used on a Route rule. - // This may not be used on the same Route rule or BackendRef as a - // RequestRedirect filter. - // - // Support in HTTPRouteRule: Extended - // - // Support in HTTPBackendRef: Extended - HTTPRouteFilterURLRewrite HTTPRouteFilterType = "URLRewrite" - - // HTTPRouteFilterRequestMirror can be used to mirror HTTP requests to a - // different backend. The responses from this backend MUST be ignored by - // the Gateway. - // - // Support in HTTPRouteRule: Extended - // - // Support in HTTPBackendRef: Extended - HTTPRouteFilterRequestMirror HTTPRouteFilterType = "RequestMirror" - - // HTTPRouteFilterExtensionRef should be used for configuring custom - // HTTP filters. - // - // Support in HTTPRouteRule: Implementation-specific - // - // Support in HTTPBackendRef: Implementation-specific - HTTPRouteFilterExtensionRef HTTPRouteFilterType = "ExtensionRef" -) +// HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute. +// +k8s:deepcopy-gen=false +type HTTPRouteTimeouts = v1.HTTPRouteTimeouts // HTTPHeader represents an HTTP Header name and value as defined by RFC 7230. -type HTTPHeader struct { - // Name is the name of the HTTP Header to be matched. Name matching MUST be - // case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2). - // - // If multiple entries specify equivalent header names, the first entry with - // an equivalent name MUST be considered for a match. Subsequent entries - // with an equivalent header name MUST be ignored. Due to the - // case-insensitivity of header names, "foo" and "Foo" are considered - // equivalent. - Name HTTPHeaderName `json:"name"` - - // Value is the value of HTTP Header to be matched. - // - // +kubebuilder:validation:MinLength=1 - // +kubebuilder:validation:MaxLength=4096 - Value string `json:"value"` -} - -// HTTPHeaderFilter defines a filter that modifies the headers of an HTTP -// request or response. Only one action for a given header name is permitted. -// Filters specifying multiple actions of the same or different type for any one -// header name are invalid and will be rejected by the webhook if installed. -// Configuration to set or add multiple values for a header must use RFC 7230 -// header value formatting, separating each value with a comma. -type HTTPHeaderFilter struct { - // Set overwrites the request with the given header (name, value) - // before the action. - // - // Input: - // GET /foo HTTP/1.1 - // my-header: foo - // - // Config: - // set: - // - name: "my-header" - // value: "bar" - // - // Output: - // GET /foo HTTP/1.1 - // my-header: bar - // - // +optional - // +listType=map - // +listMapKey=name - // +kubebuilder:validation:MaxItems=16 - Set []HTTPHeader `json:"set,omitempty"` - - // Add adds the given header(s) (name, value) to the request - // before the action. It appends to any existing values associated - // with the header name. - // - // Input: - // GET /foo HTTP/1.1 - // my-header: foo - // - // Config: - // add: - // - name: "my-header" - // value: "bar,baz" - // - // Output: - // GET /foo HTTP/1.1 - // my-header: foo,bar,baz - // - // +optional - // +listType=map - // +listMapKey=name - // +kubebuilder:validation:MaxItems=16 - Add []HTTPHeader `json:"add,omitempty"` +// +k8s:deepcopy-gen=false +type HTTPHeader = v1.HTTPHeader - // Remove the given header(s) from the HTTP request before the action. The - // value of Remove is a list of HTTP header names. Note that the header - // names are case-insensitive (see - // https://datatracker.ietf.org/doc/html/rfc2616#section-4.2). - // - // Input: - // GET /foo HTTP/1.1 - // my-header1: foo - // my-header2: bar - // my-header3: baz - // - // Config: - // remove: ["my-header1", "my-header3"] - // - // Output: - // GET /foo HTTP/1.1 - // my-header2: bar - // - // +optional - // +listType=set - // +kubebuilder:validation:MaxItems=16 - Remove []string `json:"remove,omitempty"` -} +// HTTPHeaderFilter defines a filter that modifies the headers of an HTTP request +// or response. +// +k8s:deepcopy-gen=false +type HTTPHeaderFilter = v1.HTTPHeaderFilter // HTTPPathModifierType defines the type of path redirect or rewrite. -type HTTPPathModifierType string - -const ( - // This type of modifier indicates that the full path will be replaced - // by the specified value. - FullPathHTTPPathModifier HTTPPathModifierType = "ReplaceFullPath" - - // This type of modifier indicates that any prefix path matches will be - // replaced by the substitution value. For example, a path with a prefix - // match of "/foo" and a ReplacePrefixMatch substitution of "/bar" will have - // the "/foo" prefix replaced with "/bar" in matching requests. - // - // Note that this matches the behavior of the PathPrefix match type. This - // matches full path elements. A path element refers to the list of labels - // in the path split by the `/` separator. When specified, a trailing `/` is - // ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all - // match the prefix `/abc`, but the path `/abcd` would not. - PrefixMatchHTTPPathModifier HTTPPathModifierType = "ReplacePrefixMatch" -) +// +k8s:deepcopy-gen=false +type HTTPPathModifierType = v1.HTTPPathModifierType // HTTPPathModifier defines configuration for path modifiers. -// -// +kubebuilder:validation:XValidation:message="replaceFullPath must be specified when type is set to 'ReplaceFullPath'",rule="self.type == 'ReplaceFullPath' ? has(self.replaceFullPath) : true" -// +kubebuilder:validation:XValidation:message="type must be 'ReplaceFullPath' when replaceFullPath is set",rule="has(self.replaceFullPath) ? self.type == 'ReplaceFullPath' : true" -// +kubebuilder:validation:XValidation:message="replacePrefixMatch must be specified when type is set to 'ReplacePrefixMatch'",rule="self.type == 'ReplacePrefixMatch' ? has(self.replacePrefixMatch) : true" -// +kubebuilder:validation:XValidation:message="type must be 'ReplacePrefixMatch' when replacePrefixMatch is set",rule="has(self.replacePrefixMatch) ? self.type == 'ReplacePrefixMatch' : true" -type HTTPPathModifier struct { - // Type defines the type of path modifier. Additional types may be - // added in a future release of the API. - // - // Note that values may be added to this enum, implementations - // must ensure that unknown values will not cause a crash. - // - // Unknown values here must result in the implementation setting the - // Accepted Condition for the Route to `status: False`, with a - // Reason of `UnsupportedValue`. - // - // +kubebuilder:validation:Enum=ReplaceFullPath;ReplacePrefixMatch - Type HTTPPathModifierType `json:"type"` - - // ReplaceFullPath specifies the value with which to replace the full path - // of a request during a rewrite or redirect. - // - // +kubebuilder:validation:MaxLength=1024 - // +optional - ReplaceFullPath *string `json:"replaceFullPath,omitempty"` - - // ReplacePrefixMatch specifies the value with which to replace the prefix - // match of a request during a rewrite or redirect. For example, a request - // to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch - // of "/xyz" would be modified to "/xyz/bar". - // - // Note that this matches the behavior of the PathPrefix match type. This - // matches full path elements. A path element refers to the list of labels - // in the path split by the `/` separator. When specified, a trailing `/` is - // ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all - // match the prefix `/abc`, but the path `/abcd` would not. - // - // ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch. - // Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in - // the implementation setting the Accepted Condition for the Route to `status: False`. - // - // Request Path | Prefix Match | Replace Prefix | Modified Path - // -------------|--------------|----------------|---------- - // /foo/bar | /foo | /xyz | /xyz/bar - // /foo/bar | /foo | /xyz/ | /xyz/bar - // /foo/bar | /foo/ | /xyz | /xyz/bar - // /foo/bar | /foo/ | /xyz/ | /xyz/bar - // /foo | /foo | /xyz | /xyz - // /foo/ | /foo | /xyz | /xyz/ - // /foo/bar | /foo | | /bar - // /foo/ | /foo | | / - // /foo | /foo | | / - // /foo/ | /foo | / | / - // /foo | /foo | / | / - // - // +kubebuilder:validation:MaxLength=1024 - // +optional - ReplacePrefixMatch *string `json:"replacePrefixMatch,omitempty"` -} +// +// +k8s:deepcopy-gen=false +type HTTPPathModifier = v1.HTTPPathModifier // HTTPRequestRedirect defines a filter that redirects a request. This filter // MUST NOT be used on the same Route rule as a HTTPURLRewrite filter. -type HTTPRequestRedirectFilter struct { - // Scheme is the scheme to be used in the value of the `Location` header in - // the response. When empty, the scheme of the request is used. - // - // Scheme redirects can affect the port of the redirect, for more information, - // refer to the documentation for the port field of this filter. - // - // Note that values may be added to this enum, implementations - // must ensure that unknown values will not cause a crash. - // - // Unknown values here must result in the implementation setting the - // Accepted Condition for the Route to `status: False`, with a - // Reason of `UnsupportedValue`. - // - // Support: Extended - // - // +optional - // +kubebuilder:validation:Enum=http;https - Scheme *string `json:"scheme,omitempty"` - - // Hostname is the hostname to be used in the value of the `Location` - // header in the response. - // When empty, the hostname in the `Host` header of the request is used. - // - // Support: Core - // - // +optional - Hostname *PreciseHostname `json:"hostname,omitempty"` - - // Path defines parameters used to modify the path of the incoming request. - // The modified path is then used to construct the `Location` header. When - // empty, the request path is used as-is. - // - // Support: Extended - // - // +optional - Path *HTTPPathModifier `json:"path,omitempty"` - - // Port is the port to be used in the value of the `Location` - // header in the response. - // - // If no port is specified, the redirect port MUST be derived using the - // following rules: - // - // * If redirect scheme is not-empty, the redirect port MUST be the well-known - // port associated with the redirect scheme. Specifically "http" to port 80 - // and "https" to port 443. If the redirect scheme does not have a - // well-known port, the listener port of the Gateway SHOULD be used. - // * If redirect scheme is empty, the redirect port MUST be the Gateway - // Listener port. - // - // Implementations SHOULD NOT add the port number in the 'Location' - // header in the following cases: - // - // * A Location header that will use HTTP (whether that is determined via - // the Listener protocol or the Scheme field) _and_ use port 80. - // * A Location header that will use HTTPS (whether that is determined via - // the Listener protocol or the Scheme field) _and_ use port 443. - // - // Support: Extended - // - // +optional - Port *PortNumber `json:"port,omitempty"` - - // StatusCode is the HTTP status code to be used in response. - // - // Note that values may be added to this enum, implementations - // must ensure that unknown values will not cause a crash. - // - // Unknown values here must result in the implementation setting the - // Accepted Condition for the Route to `status: False`, with a - // Reason of `UnsupportedValue`. - // - // Support: Core - // - // +optional - // +kubebuilder:default=302 - // +kubebuilder:validation:Enum=301;302 - StatusCode *int `json:"statusCode,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPRequestRedirectFilter = v1.HTTPRequestRedirectFilter // HTTPURLRewriteFilter defines a filter that modifies a request during // forwarding. At most one of these filters may be used on a Route rule. This // MUST NOT be used on the same Route rule as a HTTPRequestRedirect filter. // // Support: Extended -type HTTPURLRewriteFilter struct { - // Hostname is the value to be used to replace the Host header value during - // forwarding. - // - // Support: Extended - // - // +optional - Hostname *PreciseHostname `json:"hostname,omitempty"` - - // Path defines a path rewrite. - // - // Support: Extended - // - // +optional - Path *HTTPPathModifier `json:"path,omitempty"` -} +// +// +// +k8s:deepcopy-gen=false +type HTTPURLRewriteFilter = v1.HTTPURLRewriteFilter // HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. -type HTTPRequestMirrorFilter struct { - // BackendRef references a resource where mirrored requests are sent. - // - // Mirrored requests must be sent only to a single destination endpoint - // within this BackendRef, irrespective of how many endpoints are present - // within this BackendRef. - // - // If the referent cannot be found, this BackendRef is invalid and must be - // dropped from the Gateway. The controller must ensure the "ResolvedRefs" - // condition on the Route status is set to `status: False` and not configure - // this backend in the underlying implementation. - // - // If there is a cross-namespace reference to an *existing* object - // that is not allowed by a ReferenceGrant, the controller must ensure the - // "ResolvedRefs" condition on the Route is set to `status: False`, - // with the "RefNotPermitted" reason and not configure this backend in the - // underlying implementation. - // - // In either error case, the Message of the `ResolvedRefs` Condition - // should be used to provide more detail about the problem. - // - // Support: Extended for Kubernetes Service - // - // Support: Implementation-specific for any other resource - BackendRef BackendObjectReference `json:"backendRef"` -} +// +k8s:deepcopy-gen=false +type HTTPRequestMirrorFilter = v1.HTTPRequestMirrorFilter // HTTPBackendRef defines how a HTTPRoute should forward an HTTP request. -type HTTPBackendRef struct { - // BackendRef is a reference to a backend to forward matched requests to. - // - // A BackendRef can be invalid for the following reasons. In all cases, the - // implementation MUST ensure the `ResolvedRefs` Condition on the Route - // is set to `status: False`, with a Reason and Message that indicate - // what is the cause of the error. - // - // A BackendRef is invalid if: - // - // * It refers to an unknown or unsupported kind of resource. In this - // case, the Reason must be set to `InvalidKind` and Message of the - // Condition must explain which kind of resource is unknown or unsupported. - // - // * It refers to a resource that does not exist. In this case, the Reason must - // be set to `BackendNotFound` and the Message of the Condition must explain - // which resource does not exist. - // - // * It refers a resource in another namespace when the reference has not been - // explicitly allowed by a ReferenceGrant (or equivalent concept). In this - // case, the Reason must be set to `RefNotPermitted` and the Message of the - // Condition must explain which cross-namespace reference is not allowed. - // - // Support: Core for Kubernetes Service - // - // Support: Implementation-specific for any other resource - // - // Support for weight: Core - // - // +optional - BackendRef `json:",inline"` - - // Filters defined at this level should be executed if and only if the - // request is being forwarded to the backend defined here. - // - // Support: Implementation-specific (For broader support of filters, use the - // Filters field in HTTPRouteRule.) - // - // +optional - // +kubebuilder:validation:MaxItems=16 - // +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))" - // +kubebuilder:validation:XValidation:message="May specify either httpRouteFilterRequestRedirect or httpRouteFilterRequestRewrite, but not both",rule="!(self.exists(f, f.type == 'RequestRedirect') && self.exists(f, f.type == 'URLRewrite'))" - // +kubebuilder:validation:XValidation:message="RequestHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'RequestHeaderModifier').size() <= 1" - // +kubebuilder:validation:XValidation:message="ResponseHeaderModifier filter cannot be repeated",rule="self.filter(f, f.type == 'ResponseHeaderModifier').size() <= 1" - // +kubebuilder:validation:XValidation:message="RequestRedirect filter cannot be repeated",rule="self.filter(f, f.type == 'RequestRedirect').size() <= 1" - // +kubebuilder:validation:XValidation:message="URLRewrite filter cannot be repeated",rule="self.filter(f, f.type == 'URLRewrite').size() <= 1" - Filters []HTTPRouteFilter `json:"filters,omitempty"` -} +// +k8s:deepcopy-gen=false +type HTTPBackendRef = v1.HTTPBackendRef // HTTPRouteStatus defines the observed state of HTTPRoute. -type HTTPRouteStatus struct { - RouteStatus `json:",inline"` -} +// +k8s:deepcopy-gen=false +type HTTPRouteStatus = v1.HTTPRouteStatus diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/object_reference_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/object_reference_types.go index 4ef1c3789..64a904e1e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/object_reference_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/object_reference_types.go @@ -16,6 +16,8 @@ limitations under the License. package v1beta1 +import v1 "sigs.k8s.io/gateway-api/apis/v1" + // LocalObjectReference identifies an API object within the namespace of the // referrer. // The API object must be valid in the cluster; the Group and Kind must @@ -24,17 +26,8 @@ package v1beta1 // References to objects with invalid Group and Kind are not valid, and must // be rejected by the implementation, with appropriate Conditions set // on the containing object. -type LocalObjectReference struct { - // Group is the group of the referent. For example, "gateway.networking.k8s.io". - // When unspecified or empty string, core API group is inferred. - Group Group `json:"group"` - - // Kind is kind of the referent. For example "HTTPRoute" or "Service". - Kind Kind `json:"kind"` - - // Name is the name of the referent. - Name ObjectName `json:"name"` -} +// +k8s:deepcopy-gen=false +type LocalObjectReference = v1.LocalObjectReference // SecretObjectReference identifies an API object including its namespace, // defaulting to Secret. @@ -45,36 +38,8 @@ type LocalObjectReference struct { // References to objects with invalid Group and Kind are not valid, and must // be rejected by the implementation, with appropriate Conditions set // on the containing object. -type SecretObjectReference struct { - // Group is the group of the referent. For example, "gateway.networking.k8s.io". - // When unspecified or empty string, core API group is inferred. - // - // +optional - // +kubebuilder:default="" - Group *Group `json:"group"` - - // Kind is kind of the referent. For example "Secret". - // - // +optional - // +kubebuilder:default=Secret - Kind *Kind `json:"kind"` - - // Name is the name of the referent. - Name ObjectName `json:"name"` - - // Namespace is the namespace of the backend. When unspecified, the local - // namespace is inferred. - // - // Note that when a namespace different than the local namespace is specified, - // a ReferenceGrant object is required in the referent namespace to allow that - // namespace's owner to accept the reference. See the ReferenceGrant - // documentation for details. - // - // Support: Core - // - // +optional - Namespace *Namespace `json:"namespace,omitempty"` -} +// +k8s:deepcopy-gen=false +type SecretObjectReference = v1.SecretObjectReference // BackendObjectReference defines how an ObjectReference that is // specific to BackendRef. It includes a few additional fields and features @@ -91,57 +56,5 @@ type SecretObjectReference struct { // References to objects with invalid Group and Kind are not valid, and must // be rejected by the implementation, with appropriate Conditions set // on the containing object. -// -// +kubebuilder:validation:XValidation:message="Must have port for Service reference",rule="(size(self.group) == 0 && self.kind == 'Service') ? has(self.port) : true" -type BackendObjectReference struct { - // Group is the group of the referent. For example, "gateway.networking.k8s.io". - // When unspecified or empty string, core API group is inferred. - // - // +optional - // +kubebuilder:default="" - Group *Group `json:"group,omitempty"` - - // Kind is the Kubernetes resource kind of the referent. For example - // "Service". - // - // Defaults to "Service" when not specified. - // - // ExternalName services can refer to CNAME DNS records that may live - // outside of the cluster and as such are difficult to reason about in - // terms of conformance. They also may not be safe to forward to (see - // CVE-2021-25740 for more information). Implementations SHOULD NOT - // support ExternalName Services. - // - // Support: Core (Services with a type other than ExternalName) - // - // Support: Implementation-specific (Services with type ExternalName) - // - // +optional - // +kubebuilder:default=Service - Kind *Kind `json:"kind,omitempty"` - - // Name is the name of the referent. - Name ObjectName `json:"name"` - - // Namespace is the namespace of the backend. When unspecified, the local - // namespace is inferred. - // - // Note that when a namespace different than the local namespace is specified, - // a ReferenceGrant object is required in the referent namespace to allow that - // namespace's owner to accept the reference. See the ReferenceGrant - // documentation for details. - // - // Support: Core - // - // +optional - Namespace *Namespace `json:"namespace,omitempty"` - - // Port specifies the destination port number to use for this resource. - // Port is required when the referent is a Kubernetes Service. In this - // case, the port number is the service port number, not the target port. - // For other resources, destination port might be derived from the referent - // resource or this field. - // - // +optional - Port *PortNumber `json:"port,omitempty"` -} +// +k8s:deepcopy-gen=false +type BackendObjectReference = v1.BackendObjectReference diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/shared_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/shared_types.go index b879d3a1f..7b60f3dd7 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/shared_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/shared_types.go @@ -16,203 +16,34 @@ limitations under the License. package v1beta1 -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) +import v1 "sigs.k8s.io/gateway-api/apis/v1" // ParentReference identifies an API object (usually a Gateway) that can be considered -// a parent of this resource (usually a route). There are two kinds of parent resources -// with "Core" support: -// -// * Gateway (Gateway conformance profile) -// * Service (Mesh conformance profile, experimental, ClusterIP Services only) +// a parent of this resource (usually a route). The only kind of parent resource +// with "Core" support is Gateway. This API may be extended in the future to +// support additional kinds of parent resources, such as HTTPRoute. // -// This API may be extended in the future to support additional kinds of parent -// resources. +// Note that there are specific rules for ParentRefs which cross namespace +// boundaries. Cross-namespace references are only valid if they are explicitly +// allowed by something in the namespace they are referring to. For example: +// Gateway has the AllowedRoutes field, and ReferenceGrant provides a +// generic way to enable any other kind of cross-namespace reference. // // The API object must be valid in the cluster; the Group and Kind must // be registered in the cluster for this reference to be valid. -type ParentReference struct { - // Group is the group of the referent. - // When unspecified, "gateway.networking.k8s.io" is inferred. - // To set the core API group (such as for a "Service" kind referent), - // Group must be explicitly set to "" (empty string). - // - // Support: Core - // - // +kubebuilder:default=gateway.networking.k8s.io - // +optional - Group *Group `json:"group,omitempty"` - - // Kind is kind of the referent. - // - // There are two kinds of parent resources with "Core" support: - // - // * Gateway (Gateway conformance profile) - // * Service (Mesh conformance profile, experimental, ClusterIP Services only) - // - // Support for other resources is Implementation-Specific. - // - // +kubebuilder:default=Gateway - // +optional - Kind *Kind `json:"kind,omitempty"` - - // Namespace is the namespace of the referent. When unspecified, this refers - // to the local namespace of the Route. - // - // Note that there are specific rules for ParentRefs which cross namespace - // boundaries. Cross-namespace references are only valid if they are explicitly - // allowed by something in the namespace they are referring to. For example: - // Gateway has the AllowedRoutes field, and ReferenceGrant provides a - // generic way to enable any other kind of cross-namespace reference. - // - // ParentRefs from a Route to a Service in the same namespace are "producer" - // routes, which apply default routing rules to inbound connections from - // any namespace to the Service. - // - // ParentRefs from a Route to a Service in a different namespace are - // "consumer" routes, and these routing rules are only applied to outbound - // connections originating from the same namespace as the Route, for which - // the intended destination of the connections are a Service targeted as a - // ParentRef of the Route. - // - // Support: Core - // - // +optional - Namespace *Namespace `json:"namespace,omitempty"` - - // Name is the name of the referent. - // - // Support: Core - Name ObjectName `json:"name"` - - // SectionName is the name of a section within the target resource. In the - // following resources, SectionName is interpreted as the following: - // - // * Gateway: Listener Name. When both Port (experimental) and SectionName - // are specified, the name and port of the selected listener must match - // both specified values. - // * Service: Port Name. When both Port (experimental) and SectionName - // are specified, the name and port of the selected listener must match - // both specified values. Note that attaching Routes to Services as Parents - // is part of experimental Mesh support and is not supported for any other - // purpose. - // - // Implementations MAY choose to support attaching Routes to other resources. - // If that is the case, they MUST clearly document how SectionName is - // interpreted. - // - // When unspecified (empty string), this will reference the entire resource. - // For the purpose of status, an attachment is considered successful if at - // least one section in the parent resource accepts it. For example, Gateway - // listeners can restrict which Routes can attach to them by Route kind, - // namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from - // the referencing Route, the Route MUST be considered successfully - // attached. If no Gateway listeners accept attachment from this Route, the - // Route MUST be considered detached from the Gateway. - // - // Support: Core - // - // +optional - SectionName *SectionName `json:"sectionName,omitempty"` - - // Port is the network port this Route targets. It can be interpreted - // differently based on the type of parent resource. - // - // When the parent resource is a Gateway, this targets all listeners - // listening on the specified port that also support this kind of Route(and - // select this Route). It's not recommended to set `Port` unless the - // networking behaviors specified in a Route must apply to a specific port - // as opposed to a listener(s) whose port(s) may be changed. When both Port - // and SectionName are specified, the name and port of the selected listener - // must match both specified values. - // - // When the parent resource is a Service, this targets a specific port in the - // Service spec. When both Port (experimental) and SectionName are specified, - // the name and port of the selected port must match both specified values. - // - // Implementations MAY choose to support other parent resources. - // Implementations supporting other types of parent resources MUST clearly - // document how/if Port is interpreted. - // - // For the purpose of status, an attachment is considered successful as - // long as the parent resource accepts it partially. For example, Gateway - // listeners can restrict which Routes can attach to them by Route kind, - // namespace, or hostname. If 1 of 2 Gateway listeners accept attachment - // from the referencing Route, the Route MUST be considered successfully - // attached. If no Gateway listeners accept attachment from this Route, - // the Route MUST be considered detached from the Gateway. - // - // Support: Extended - // - // +optional - // - Port *PortNumber `json:"port,omitempty"` -} +// +k8s:deepcopy-gen=false +type ParentReference = v1.ParentReference // CommonRouteSpec defines the common attributes that all Routes MUST include // within their spec. -type CommonRouteSpec struct { - // ParentRefs references the resources (usually Gateways) that a Route wants - // to be attached to. Note that the referenced parent resource needs to - // allow this for the attachment to be complete. For Gateways, that means - // the Gateway needs to allow attachment from Routes of this kind and - // namespace. For Services, that means the Service must either be in the same - // namespace for a "producer" route, or the mesh implementation must support - // and allow "consumer" routes for the referenced Service. ReferenceGrant is - // not applicable for governing ParentRefs to Services - it is not possible to - // create a "producer" route for a Service in a different namespace from the - // Route. - // - // There are two kinds of parent resources with "Core" support: - // - // * Gateway (Gateway conformance profile) - // * Service (Mesh conformance profile, experimental, ClusterIP Services only) - // - // This API may be extended in the future to support additional kinds of parent - // resources. - // - // It is invalid to reference an identical parent more than once. It is - // valid to reference multiple distinct sections within the same parent - // resource, such as two separate Listeners on the same Gateway or two separate - // ports on the same Service. - // - // It is possible to separately reference multiple distinct objects that may - // be collapsed by an implementation. For example, some implementations may - // choose to merge compatible Gateway Listeners together. If that is the - // case, the list of routes attached to those resources should also be - // merged. - // - // Note that for ParentRefs that cross namespace boundaries, there are specific - // rules. Cross-namespace references are only valid if they are explicitly - // allowed by something in the namespace they are referring to. For example, - // Gateway has the AllowedRoutes field, and ReferenceGrant provides a - // generic way to enable other kinds of cross-namespace reference. - // - // ParentRefs from a Route to a Service in the same namespace are "producer" - // routes, which apply default routing rules to inbound connections from - // any namespace to the Service. - // - // ParentRefs from a Route to a Service in a different namespace are - // "consumer" routes, and these routing rules are only applied to outbound - // connections originating from the same namespace as the Route, for which - // the intended destination of the connections are a Service targeted as a - // ParentRef of the Route. - // - // +optional - // +kubebuilder:validation:MaxItems=32 - // - // - // - // - ParentRefs []ParentReference `json:"parentRefs,omitempty"` -} +// +k8s:deepcopy-gen=false +type CommonRouteSpec = v1.CommonRouteSpec // PortNumber defines a network port. // // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=65535 -type PortNumber int32 +type PortNumber = v1.PortNumber // BackendRef defines how a Route should forward a request to a Kubernetes // resource. @@ -221,36 +52,14 @@ type PortNumber int32 // ReferenceGrant object is required in the referent namespace to allow that // namespace's owner to accept the reference. See the ReferenceGrant // documentation for details. -type BackendRef struct { - // BackendObjectReference references a Kubernetes object. - BackendObjectReference `json:",inline"` - - // Weight specifies the proportion of requests forwarded to the referenced - // backend. This is computed as weight/(sum of all weights in this - // BackendRefs list). For non-zero values, there may be some epsilon from - // the exact proportion defined here depending on the precision an - // implementation supports. Weight is not a percentage and the sum of - // weights does not need to equal 100. - // - // If only one backend is specified and it has a weight greater than 0, 100% - // of the traffic is forwarded to that backend. If weight is set to 0, no - // traffic should be forwarded for this entry. If unspecified, weight - // defaults to 1. - // - // Support for this field varies based on the context where used. - // - // +optional - // +kubebuilder:default=1 - // +kubebuilder:validation:Minimum=0 - // +kubebuilder:validation:Maximum=1000000 - Weight *int32 `json:"weight,omitempty"` -} +// +k8s:deepcopy-gen=false +type BackendRef = v1.BackendRef // RouteConditionType is a type of condition for a route. -type RouteConditionType string +type RouteConditionType = v1.RouteConditionType // RouteConditionReason is a reason for a route condition. -type RouteConditionReason string +type RouteConditionReason = v1.RouteConditionReason const ( // This condition indicates whether the route has been accepted or rejected @@ -264,7 +73,6 @@ const ( // // * "NotAllowedByListeners" // * "NoMatchingListenerHostname" - // * "NoMatchingParent" // * "UnsupportedValue" // // Possible reasons for this condition to be Unknown are: @@ -289,12 +97,6 @@ const ( // compatible Listeners whose Hostname matches the route RouteReasonNoMatchingListenerHostname RouteConditionReason = "NoMatchingListenerHostname" - // This reason is used with the "Accepted" condition when there are - // no matching Parents. In the case of Gateways, this can occur when - // a Route ParentRef specifies a Port and/or SectionName that does not - // match any Listeners in the Gateway. - RouteReasonNoMatchingParent RouteConditionReason = "NoMatchingParent" - // This reason is used with the "Accepted" condition when a value for an Enum // is not recognized. RouteReasonUnsupportedValue RouteConditionReason = "UnsupportedValue" @@ -303,11 +105,6 @@ const ( // reconciled the route. RouteReasonPending RouteConditionReason = "Pending" - // This reason is used with the "Accepted" condition when there - // are incompatible filters present on a route rule (for example if - // the URLRewrite and RequestRedirect are both present on an HTTPRoute). - RouteReasonIncompatibleFilters RouteConditionReason = "IncompatibleFilters" - // This condition indicates whether the controller was able to resolve all // the object references for the Route. // @@ -348,74 +145,13 @@ const ( // RouteParentStatus describes the status of a route with respect to an // associated Parent. -type RouteParentStatus struct { - // ParentRef corresponds with a ParentRef in the spec that this - // RouteParentStatus struct describes the status of. - ParentRef ParentReference `json:"parentRef"` - - // ControllerName is a domain/path string that indicates the name of the - // controller that wrote this status. This corresponds with the - // controllerName field on GatewayClass. - // - // Example: "example.net/gateway-controller". - // - // The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are - // valid Kubernetes names - // (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). - // - // Controllers MUST populate this field when writing status. Controllers should ensure that - // entries to status populated with their ControllerName are cleaned up when they are no - // longer necessary. - ControllerName GatewayController `json:"controllerName"` - - // Conditions describes the status of the route with respect to the Gateway. - // Note that the route's availability is also subject to the Gateway's own - // status conditions and listener status. - // - // If the Route's ParentRef specifies an existing Gateway that supports - // Routes of this kind AND that Gateway's controller has sufficient access, - // then that Gateway's controller MUST set the "Accepted" condition on the - // Route, to indicate whether the route has been accepted or rejected by the - // Gateway, and why. - // - // A Route MUST be considered "Accepted" if at least one of the Route's - // rules is implemented by the Gateway. - // - // There are a number of cases where the "Accepted" condition may not be set - // due to lack of controller visibility, that includes when: - // - // * The Route refers to a non-existent parent. - // * The Route is of a type that the controller does not support. - // * The Route is in a namespace the controller does not have access to. - // - // +listType=map - // +listMapKey=type - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=8 - Conditions []metav1.Condition `json:"conditions,omitempty"` -} +// +k8s:deepcopy-gen=false +type RouteParentStatus = v1.RouteParentStatus // RouteStatus defines the common attributes that all Routes MUST include within // their status. -type RouteStatus struct { - // Parents is a list of parent resources (usually Gateways) that are - // associated with the route, and the status of the route with respect to - // each parent. When this route attaches to a parent, the controller that - // manages the parent must add an entry to this list when the controller - // first sees the route and should update the entry as appropriate when the - // route or gateway is modified. - // - // Note that parent references that cannot be resolved by an implementation - // of this API will not be added to this list. Implementations of this API - // can only populate Route status for the Gateways/parent resources they are - // responsible for. - // - // A maximum of 32 Gateways will be represented in this list. An empty list - // means the route has not been attached to any Gateway. - // - // +kubebuilder:validation:MaxItems=32 - Parents []RouteParentStatus `json:"parents"` -} +// +k8s:deepcopy-gen=false +type RouteStatus = v1.RouteStatus // Hostname is the fully qualified domain name of a network host. This matches // the RFC 1123 definition of a hostname with 2 notable exceptions: @@ -435,7 +171,7 @@ type RouteStatus struct { // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -type Hostname string +type Hostname = v1.Hostname // PreciseHostname is the fully qualified domain name of a network host. This // matches the RFC 1123 definition of a hostname with 1 notable exception that @@ -448,7 +184,7 @@ type Hostname string // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -type PreciseHostname string +type PreciseHostname = v1.PreciseHostname // Group refers to a Kubernetes Group. It must either be an empty string or a // RFC 1123 subdomain. @@ -459,7 +195,7 @@ type PreciseHostname string // Valid values include: // // * "" - empty string implies core Kubernetes API group -// * "gateway.networking.k8s.io" +// * "networking.k8s.io" // * "foo.example.com" // // Invalid values include: @@ -468,7 +204,7 @@ type PreciseHostname string // // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` -type Group string +type Group = v1.Group // Kind refers to a Kubernetes Kind. // @@ -484,7 +220,7 @@ type Group string // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=63 // +kubebuilder:validation:Pattern=`^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` -type Kind string +type Kind = v1.Kind // ObjectName refers to the name of a Kubernetes object. // Object names can have a variety of forms, including RFC1123 subdomains, @@ -492,7 +228,7 @@ type Kind string // // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 -type ObjectName string +type ObjectName = v1.ObjectName // Namespace refers to a Kubernetes namespace. It must be a RFC 1123 label. // @@ -513,7 +249,7 @@ type ObjectName string // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=63 -type Namespace string +type Namespace = v1.Namespace // SectionName is the name of a section in a Kubernetes resource. // @@ -532,7 +268,7 @@ type Namespace string // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 -type SectionName string +type SectionName = v1.SectionName // GatewayController is the name of a Gateway API controller. It must be a // domain prefixed path. @@ -549,7 +285,7 @@ type SectionName string // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` -type GatewayController string +type GatewayController = v1.GatewayController // AnnotationKey is the key of an annotation in Gateway API. This is used for // validation of maps such as TLS options. This matches the Kubernetes @@ -571,7 +307,7 @@ type GatewayController string // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]/?)*$` -type AnnotationKey string +type AnnotationKey = v1.AnnotationKey // AnnotationValue is the value of an annotation in Gateway API. This is used // for validation of maps such as TLS options. This roughly matches Kubernetes @@ -580,7 +316,7 @@ type AnnotationKey string // // +kubebuilder:validation:MinLength=0 // +kubebuilder:validation:MaxLength=4096 -type AnnotationValue string +type AnnotationValue = v1.AnnotationValue // AddressType defines how a network address is represented as a text string. // This may take two possible forms: @@ -600,21 +336,11 @@ type AnnotationValue string // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 // +kubebuilder:validation:Pattern=`^Hostname|IPAddress|NamedAddress|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$` -type AddressType string - -// HeaderName is the name of a header or query parameter. -// -// +kubebuilder:validation:MinLength=1 -// +kubebuilder:validation:MaxLength=256 -// +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$` -// +k8s:deepcopy-gen=false -type HeaderName string +type AddressType = v1.AddressType // Duration is a string value representing a duration in time. The format is as specified // in GEP-2257, a strict subset of the syntax parsed by Golang time.ParseDuration. -// -// +kubebuilder:validation:Pattern=`^([0-9]{1,5}(h|m|s|ms)){1,4}$` -type Duration string +type Duration = v1.Duration const ( // A textual representation of a numeric IP address. IPv4 diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/zz_generated.deepcopy.go index b4c502836..53dd02b67 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/zz_generated.deepcopy.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1beta1/zz_generated.deepcopy.go @@ -21,115 +21,10 @@ limitations under the License. package v1beta1 import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "sigs.k8s.io/gateway-api/apis/v1" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AllowedRoutes) DeepCopyInto(out *AllowedRoutes) { - *out = *in - if in.Namespaces != nil { - in, out := &in.Namespaces, &out.Namespaces - *out = new(RouteNamespaces) - (*in).DeepCopyInto(*out) - } - if in.Kinds != nil { - in, out := &in.Kinds, &out.Kinds - *out = make([]RouteGroupKind, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AllowedRoutes. -func (in *AllowedRoutes) DeepCopy() *AllowedRoutes { - if in == nil { - return nil - } - out := new(AllowedRoutes) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendObjectReference) DeepCopyInto(out *BackendObjectReference) { - *out = *in - if in.Group != nil { - in, out := &in.Group, &out.Group - *out = new(Group) - **out = **in - } - if in.Kind != nil { - in, out := &in.Kind, &out.Kind - *out = new(Kind) - **out = **in - } - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(Namespace) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendObjectReference. -func (in *BackendObjectReference) DeepCopy() *BackendObjectReference { - if in == nil { - return nil - } - out := new(BackendObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BackendRef) DeepCopyInto(out *BackendRef) { - *out = *in - in.BackendObjectReference.DeepCopyInto(&out.BackendObjectReference) - if in.Weight != nil { - in, out := &in.Weight, &out.Weight - *out = new(int32) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendRef. -func (in *BackendRef) DeepCopy() *BackendRef { - if in == nil { - return nil - } - out := new(BackendRef) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CommonRouteSpec) DeepCopyInto(out *CommonRouteSpec) { - *out = *in - if in.ParentRefs != nil { - in, out := &in.ParentRefs, &out.ParentRefs - *out = make([]ParentReference, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonRouteSpec. -func (in *CommonRouteSpec) DeepCopy() *CommonRouteSpec { - if in == nil { - return nil - } - out := new(CommonRouteSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Gateway) DeepCopyInto(out *Gateway) { *out = *in @@ -157,26 +52,6 @@ func (in *Gateway) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayAddress) DeepCopyInto(out *GatewayAddress) { - *out = *in - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(AddressType) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayAddress. -func (in *GatewayAddress) DeepCopy() *GatewayAddress { - if in == nil { - return nil - } - out := new(GatewayAddress) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatewayClass) DeepCopyInto(out *GatewayClass) { *out = *in @@ -236,53 +111,6 @@ func (in *GatewayClassList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayClassSpec) DeepCopyInto(out *GatewayClassSpec) { - *out = *in - if in.ParametersRef != nil { - in, out := &in.ParametersRef, &out.ParametersRef - *out = new(ParametersReference) - (*in).DeepCopyInto(*out) - } - if in.Description != nil { - in, out := &in.Description, &out.Description - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClassSpec. -func (in *GatewayClassSpec) DeepCopy() *GatewayClassSpec { - if in == nil { - return nil - } - out := new(GatewayClassSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayClassStatus) DeepCopyInto(out *GatewayClassStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayClassStatus. -func (in *GatewayClassStatus) DeepCopy() *GatewayClassStatus { - if in == nil { - return nil - } - out := new(GatewayClassStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatewayList) DeepCopyInto(out *GatewayList) { *out = *in @@ -316,862 +144,176 @@ func (in *GatewayList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { +func (in *HTTPRoute) DeepCopyInto(out *HTTPRoute) { *out = *in - if in.Listeners != nil { - in, out := &in.Listeners, &out.Listeners - *out = make([]Listener, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]GatewayAddress, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec. -func (in *GatewaySpec) DeepCopy() *GatewaySpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRoute. +func (in *HTTPRoute) DeepCopy() *HTTPRoute { if in == nil { return nil } - out := new(GatewaySpec) + out := new(HTTPRoute) in.DeepCopyInto(out) return out } +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HTTPRoute) 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 *GatewayStatus) DeepCopyInto(out *GatewayStatus) { +func (in *HTTPRouteList) DeepCopyInto(out *HTTPRouteList) { *out = *in - if in.Addresses != nil { - in, out := &in.Addresses, &out.Addresses - *out = make([]GatewayStatusAddress, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Listeners != nil { - in, out := &in.Listeners, &out.Listeners - *out = make([]ListenerStatus, len(*in)) + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HTTPRoute, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayStatus. -func (in *GatewayStatus) DeepCopy() *GatewayStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteList. +func (in *HTTPRouteList) DeepCopy() *HTTPRouteList { if in == nil { return nil } - out := new(GatewayStatus) + out := new(HTTPRouteList) in.DeepCopyInto(out) return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayStatusAddress) DeepCopyInto(out *GatewayStatusAddress) { - *out = *in - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(AddressType) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayStatusAddress. -func (in *GatewayStatusAddress) DeepCopy() *GatewayStatusAddress { - if in == nil { - return nil +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HTTPRouteList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c } - out := new(GatewayStatusAddress) - in.DeepCopyInto(out) - return out + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GatewayTLSConfig) DeepCopyInto(out *GatewayTLSConfig) { +func (in *ReferenceGrant) DeepCopyInto(out *ReferenceGrant) { *out = *in - if in.Mode != nil { - in, out := &in.Mode, &out.Mode - *out = new(TLSModeType) - **out = **in - } - if in.CertificateRefs != nil { - in, out := &in.CertificateRefs, &out.CertificateRefs - *out = make([]SecretObjectReference, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Options != nil { - in, out := &in.Options, &out.Options - *out = make(map[AnnotationKey]AnnotationValue, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayTLSConfig. -func (in *GatewayTLSConfig) DeepCopy() *GatewayTLSConfig { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrant. +func (in *ReferenceGrant) DeepCopy() *ReferenceGrant { if in == nil { return nil } - out := new(GatewayTLSConfig) + out := new(ReferenceGrant) in.DeepCopyInto(out) return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPBackendRef) DeepCopyInto(out *HTTPBackendRef) { - *out = *in - in.BackendRef.DeepCopyInto(&out.BackendRef) - if in.Filters != nil { - in, out := &in.Filters, &out.Filters - *out = make([]HTTPRouteFilter, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPBackendRef. -func (in *HTTPBackendRef) DeepCopy() *HTTPBackendRef { - if in == nil { - return nil +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReferenceGrant) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c } - out := new(HTTPBackendRef) - in.DeepCopyInto(out) - return out + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPHeader) DeepCopyInto(out *HTTPHeader) { +func (in *ReferenceGrantFrom) DeepCopyInto(out *ReferenceGrantFrom) { *out = *in } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeader. -func (in *HTTPHeader) DeepCopy() *HTTPHeader { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantFrom. +func (in *ReferenceGrantFrom) DeepCopy() *ReferenceGrantFrom { if in == nil { return nil } - out := new(HTTPHeader) + out := new(ReferenceGrantFrom) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPHeaderFilter) DeepCopyInto(out *HTTPHeaderFilter) { +func (in *ReferenceGrantList) DeepCopyInto(out *ReferenceGrantList) { *out = *in - if in.Set != nil { - in, out := &in.Set, &out.Set - *out = make([]HTTPHeader, len(*in)) - copy(*out, *in) - } - if in.Add != nil { - in, out := &in.Add, &out.Add - *out = make([]HTTPHeader, len(*in)) - copy(*out, *in) - } - if in.Remove != nil { - in, out := &in.Remove, &out.Remove - *out = make([]string, len(*in)) - copy(*out, *in) + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ReferenceGrant, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeaderFilter. -func (in *HTTPHeaderFilter) DeepCopy() *HTTPHeaderFilter { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantList. +func (in *ReferenceGrantList) DeepCopy() *ReferenceGrantList { if in == nil { return nil } - out := new(HTTPHeaderFilter) + out := new(ReferenceGrantList) in.DeepCopyInto(out) return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPHeaderMatch) DeepCopyInto(out *HTTPHeaderMatch) { - *out = *in - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(HeaderMatchType) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeaderMatch. -func (in *HTTPHeaderMatch) DeepCopy() *HTTPHeaderMatch { - if in == nil { - return nil +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReferenceGrantList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c } - out := new(HTTPHeaderMatch) - in.DeepCopyInto(out) - return out + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPPathMatch) DeepCopyInto(out *HTTPPathMatch) { +func (in *ReferenceGrantSpec) DeepCopyInto(out *ReferenceGrantSpec) { *out = *in - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(PathMatchType) - **out = **in + if in.From != nil { + in, out := &in.From, &out.From + *out = make([]ReferenceGrantFrom, len(*in)) + copy(*out, *in) } - if in.Value != nil { - in, out := &in.Value, &out.Value - *out = new(string) - **out = **in + if in.To != nil { + in, out := &in.To, &out.To + *out = make([]ReferenceGrantTo, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPathMatch. -func (in *HTTPPathMatch) DeepCopy() *HTTPPathMatch { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantSpec. +func (in *ReferenceGrantSpec) DeepCopy() *ReferenceGrantSpec { if in == nil { return nil } - out := new(HTTPPathMatch) + out := new(ReferenceGrantSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPPathModifier) DeepCopyInto(out *HTTPPathModifier) { +func (in *ReferenceGrantTo) DeepCopyInto(out *ReferenceGrantTo) { *out = *in - if in.ReplaceFullPath != nil { - in, out := &in.ReplaceFullPath, &out.ReplaceFullPath - *out = new(string) - **out = **in - } - if in.ReplacePrefixMatch != nil { - in, out := &in.ReplacePrefixMatch, &out.ReplacePrefixMatch - *out = new(string) + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.ObjectName) **out = **in } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPPathModifier. -func (in *HTTPPathModifier) DeepCopy() *HTTPPathModifier { - if in == nil { - return nil - } - out := new(HTTPPathModifier) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPQueryParamMatch) DeepCopyInto(out *HTTPQueryParamMatch) { - *out = *in - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(QueryParamMatchType) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPQueryParamMatch. -func (in *HTTPQueryParamMatch) DeepCopy() *HTTPQueryParamMatch { - if in == nil { - return nil - } - out := new(HTTPQueryParamMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRequestMirrorFilter) DeepCopyInto(out *HTTPRequestMirrorFilter) { - *out = *in - in.BackendRef.DeepCopyInto(&out.BackendRef) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. -func (in *HTTPRequestMirrorFilter) DeepCopy() *HTTPRequestMirrorFilter { - if in == nil { - return nil - } - out := new(HTTPRequestMirrorFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRequestRedirectFilter) DeepCopyInto(out *HTTPRequestRedirectFilter) { - *out = *in - if in.Scheme != nil { - in, out := &in.Scheme, &out.Scheme - *out = new(string) - **out = **in - } - if in.Hostname != nil { - in, out := &in.Hostname, &out.Hostname - *out = new(PreciseHostname) - **out = **in - } - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(HTTPPathModifier) - (*in).DeepCopyInto(*out) - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in - } - if in.StatusCode != nil { - in, out := &in.StatusCode, &out.StatusCode - *out = new(int) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestRedirectFilter. -func (in *HTTPRequestRedirectFilter) DeepCopy() *HTTPRequestRedirectFilter { - if in == nil { - return nil - } - out := new(HTTPRequestRedirectFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRoute) DeepCopyInto(out *HTTPRoute) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRoute. -func (in *HTTPRoute) DeepCopy() *HTTPRoute { - if in == nil { - return nil - } - out := new(HTTPRoute) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HTTPRoute) 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 *HTTPRouteFilter) DeepCopyInto(out *HTTPRouteFilter) { - *out = *in - if in.RequestHeaderModifier != nil { - in, out := &in.RequestHeaderModifier, &out.RequestHeaderModifier - *out = new(HTTPHeaderFilter) - (*in).DeepCopyInto(*out) - } - if in.ResponseHeaderModifier != nil { - in, out := &in.ResponseHeaderModifier, &out.ResponseHeaderModifier - *out = new(HTTPHeaderFilter) - (*in).DeepCopyInto(*out) - } - if in.RequestMirror != nil { - in, out := &in.RequestMirror, &out.RequestMirror - *out = new(HTTPRequestMirrorFilter) - (*in).DeepCopyInto(*out) - } - if in.RequestRedirect != nil { - in, out := &in.RequestRedirect, &out.RequestRedirect - *out = new(HTTPRequestRedirectFilter) - (*in).DeepCopyInto(*out) - } - if in.URLRewrite != nil { - in, out := &in.URLRewrite, &out.URLRewrite - *out = new(HTTPURLRewriteFilter) - (*in).DeepCopyInto(*out) - } - if in.ExtensionRef != nil { - in, out := &in.ExtensionRef, &out.ExtensionRef - *out = new(LocalObjectReference) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteFilter. -func (in *HTTPRouteFilter) DeepCopy() *HTTPRouteFilter { - if in == nil { - return nil - } - out := new(HTTPRouteFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteList) DeepCopyInto(out *HTTPRouteList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]HTTPRoute, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteList. -func (in *HTTPRouteList) DeepCopy() *HTTPRouteList { - if in == nil { - return nil - } - out := new(HTTPRouteList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HTTPRouteList) 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 *HTTPRouteMatch) DeepCopyInto(out *HTTPRouteMatch) { - *out = *in - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(HTTPPathMatch) - (*in).DeepCopyInto(*out) - } - if in.Headers != nil { - in, out := &in.Headers, &out.Headers - *out = make([]HTTPHeaderMatch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.QueryParams != nil { - in, out := &in.QueryParams, &out.QueryParams - *out = make([]HTTPQueryParamMatch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Method != nil { - in, out := &in.Method, &out.Method - *out = new(HTTPMethod) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteMatch. -func (in *HTTPRouteMatch) DeepCopy() *HTTPRouteMatch { - if in == nil { - return nil - } - out := new(HTTPRouteMatch) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteRule) DeepCopyInto(out *HTTPRouteRule) { - *out = *in - if in.Matches != nil { - in, out := &in.Matches, &out.Matches - *out = make([]HTTPRouteMatch, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Filters != nil { - in, out := &in.Filters, &out.Filters - *out = make([]HTTPRouteFilter, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.BackendRefs != nil { - in, out := &in.BackendRefs, &out.BackendRefs - *out = make([]HTTPBackendRef, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Timeouts != nil { - in, out := &in.Timeouts, &out.Timeouts - *out = new(HTTPRouteTimeouts) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteRule. -func (in *HTTPRouteRule) DeepCopy() *HTTPRouteRule { - if in == nil { - return nil - } - out := new(HTTPRouteRule) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteSpec) DeepCopyInto(out *HTTPRouteSpec) { - *out = *in - in.CommonRouteSpec.DeepCopyInto(&out.CommonRouteSpec) - if in.Hostnames != nil { - in, out := &in.Hostnames, &out.Hostnames - *out = make([]Hostname, len(*in)) - copy(*out, *in) - } - if in.Rules != nil { - in, out := &in.Rules, &out.Rules - *out = make([]HTTPRouteRule, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteSpec. -func (in *HTTPRouteSpec) DeepCopy() *HTTPRouteSpec { - if in == nil { - return nil - } - out := new(HTTPRouteSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteStatus) DeepCopyInto(out *HTTPRouteStatus) { - *out = *in - in.RouteStatus.DeepCopyInto(&out.RouteStatus) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteStatus. -func (in *HTTPRouteStatus) DeepCopy() *HTTPRouteStatus { - if in == nil { - return nil - } - out := new(HTTPRouteStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPRouteTimeouts) DeepCopyInto(out *HTTPRouteTimeouts) { - *out = *in - if in.Request != nil { - in, out := &in.Request, &out.Request - *out = new(Duration) - **out = **in - } - if in.BackendRequest != nil { - in, out := &in.BackendRequest, &out.BackendRequest - *out = new(Duration) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteTimeouts. -func (in *HTTPRouteTimeouts) DeepCopy() *HTTPRouteTimeouts { - if in == nil { - return nil - } - out := new(HTTPRouteTimeouts) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HTTPURLRewriteFilter) DeepCopyInto(out *HTTPURLRewriteFilter) { - *out = *in - if in.Hostname != nil { - in, out := &in.Hostname, &out.Hostname - *out = new(PreciseHostname) - **out = **in - } - if in.Path != nil { - in, out := &in.Path, &out.Path - *out = new(HTTPPathModifier) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPURLRewriteFilter. -func (in *HTTPURLRewriteFilter) DeepCopy() *HTTPURLRewriteFilter { - if in == nil { - return nil - } - out := new(HTTPURLRewriteFilter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Listener) DeepCopyInto(out *Listener) { - *out = *in - if in.Hostname != nil { - in, out := &in.Hostname, &out.Hostname - *out = new(Hostname) - **out = **in - } - if in.TLS != nil { - in, out := &in.TLS, &out.TLS - *out = new(GatewayTLSConfig) - (*in).DeepCopyInto(*out) - } - if in.AllowedRoutes != nil { - in, out := &in.AllowedRoutes, &out.AllowedRoutes - *out = new(AllowedRoutes) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Listener. -func (in *Listener) DeepCopy() *Listener { - if in == nil { - return nil - } - out := new(Listener) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ListenerStatus) DeepCopyInto(out *ListenerStatus) { - *out = *in - if in.SupportedKinds != nil { - in, out := &in.SupportedKinds, &out.SupportedKinds - *out = make([]RouteGroupKind, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ListenerStatus. -func (in *ListenerStatus) DeepCopy() *ListenerStatus { - if in == nil { - return nil - } - out := new(ListenerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LocalObjectReference) DeepCopyInto(out *LocalObjectReference) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalObjectReference. -func (in *LocalObjectReference) DeepCopy() *LocalObjectReference { - if in == nil { - return nil - } - out := new(LocalObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ParametersReference) DeepCopyInto(out *ParametersReference) { - *out = *in - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(Namespace) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParametersReference. -func (in *ParametersReference) DeepCopy() *ParametersReference { - if in == nil { - return nil - } - out := new(ParametersReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ParentReference) DeepCopyInto(out *ParentReference) { - *out = *in - if in.Group != nil { - in, out := &in.Group, &out.Group - *out = new(Group) - **out = **in - } - if in.Kind != nil { - in, out := &in.Kind, &out.Kind - *out = new(Kind) - **out = **in - } - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(Namespace) - **out = **in - } - if in.SectionName != nil { - in, out := &in.SectionName, &out.SectionName - *out = new(SectionName) - **out = **in - } - if in.Port != nil { - in, out := &in.Port, &out.Port - *out = new(PortNumber) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParentReference. -func (in *ParentReference) DeepCopy() *ParentReference { - if in == nil { - return nil - } - out := new(ParentReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReferenceGrant) DeepCopyInto(out *ReferenceGrant) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrant. -func (in *ReferenceGrant) DeepCopy() *ReferenceGrant { - if in == nil { - return nil - } - out := new(ReferenceGrant) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ReferenceGrant) 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 *ReferenceGrantFrom) DeepCopyInto(out *ReferenceGrantFrom) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantFrom. -func (in *ReferenceGrantFrom) DeepCopy() *ReferenceGrantFrom { - if in == nil { - return nil - } - out := new(ReferenceGrantFrom) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReferenceGrantList) DeepCopyInto(out *ReferenceGrantList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ReferenceGrant, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantList. -func (in *ReferenceGrantList) DeepCopy() *ReferenceGrantList { - if in == nil { - return nil - } - out := new(ReferenceGrantList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ReferenceGrantList) 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 *ReferenceGrantSpec) DeepCopyInto(out *ReferenceGrantSpec) { - *out = *in - if in.From != nil { - in, out := &in.From, &out.From - *out = make([]ReferenceGrantFrom, len(*in)) - copy(*out, *in) - } - if in.To != nil { - in, out := &in.To, &out.To - *out = make([]ReferenceGrantTo, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantSpec. -func (in *ReferenceGrantSpec) DeepCopy() *ReferenceGrantSpec { - if in == nil { - return nil - } - out := new(ReferenceGrantSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ReferenceGrantTo) DeepCopyInto(out *ReferenceGrantTo) { - *out = *in - if in.Name != nil { - in, out := &in.Name, &out.Name - *out = new(ObjectName) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantTo. -func (in *ReferenceGrantTo) DeepCopy() *ReferenceGrantTo { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferenceGrantTo. +func (in *ReferenceGrantTo) DeepCopy() *ReferenceGrantTo { if in == nil { return nil } @@ -1179,123 +321,3 @@ func (in *ReferenceGrantTo) DeepCopy() *ReferenceGrantTo { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteGroupKind) DeepCopyInto(out *RouteGroupKind) { - *out = *in - if in.Group != nil { - in, out := &in.Group, &out.Group - *out = new(Group) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteGroupKind. -func (in *RouteGroupKind) DeepCopy() *RouteGroupKind { - if in == nil { - return nil - } - out := new(RouteGroupKind) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteNamespaces) DeepCopyInto(out *RouteNamespaces) { - *out = *in - if in.From != nil { - in, out := &in.From, &out.From - *out = new(FromNamespaces) - **out = **in - } - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteNamespaces. -func (in *RouteNamespaces) DeepCopy() *RouteNamespaces { - if in == nil { - return nil - } - out := new(RouteNamespaces) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteParentStatus) DeepCopyInto(out *RouteParentStatus) { - *out = *in - in.ParentRef.DeepCopyInto(&out.ParentRef) - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteParentStatus. -func (in *RouteParentStatus) DeepCopy() *RouteParentStatus { - if in == nil { - return nil - } - out := new(RouteParentStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RouteStatus) DeepCopyInto(out *RouteStatus) { - *out = *in - if in.Parents != nil { - in, out := &in.Parents, &out.Parents - *out = make([]RouteParentStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteStatus. -func (in *RouteStatus) DeepCopy() *RouteStatus { - if in == nil { - return nil - } - out := new(RouteStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecretObjectReference) DeepCopyInto(out *SecretObjectReference) { - *out = *in - if in.Group != nil { - in, out := &in.Group, &out.Group - *out = new(Group) - **out = **in - } - if in.Kind != nil { - in, out := &in.Kind, &out.Kind - *out = new(Kind) - **out = **in - } - if in.Namespace != nil { - in, out := &in.Namespace, &out.Namespace - *out = new(Namespace) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretObjectReference. -func (in *SecretObjectReference) DeepCopy() *SecretObjectReference { - if in == nil { - return nil - } - out := new(SecretObjectReference) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/clientset.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/clientset.go index 342a48d34..743be8d8f 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/clientset.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/clientset.go @@ -25,6 +25,7 @@ import ( discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" + gatewayv1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1" gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1" ) @@ -33,6 +34,7 @@ type Interface interface { Discovery() discovery.DiscoveryInterface GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface + GatewayV1() gatewayv1.GatewayV1Interface } // Clientset contains the clients for groups. @@ -40,6 +42,7 @@ type Clientset struct { *discovery.DiscoveryClient gatewayV1alpha2 *gatewayv1alpha2.GatewayV1alpha2Client gatewayV1beta1 *gatewayv1beta1.GatewayV1beta1Client + gatewayV1 *gatewayv1.GatewayV1Client } // GatewayV1alpha2 retrieves the GatewayV1alpha2Client @@ -52,6 +55,11 @@ func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { return c.gatewayV1beta1 } +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return c.gatewayV1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -104,6 +112,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -127,6 +139,7 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.gatewayV1alpha2 = gatewayv1alpha2.New(c) cs.gatewayV1beta1 = gatewayv1beta1.New(c) + cs.gatewayV1 = gatewayv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/clientset_generated.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/clientset_generated.go index 62bd30006..a3045a710 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -25,6 +25,8 @@ import ( fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" clientset "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + gatewayv1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1" + fakegatewayv1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake" gatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2" fakegatewayv1alpha2 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake" gatewayv1beta1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1" @@ -90,3 +92,8 @@ func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { return &fakegatewayv1beta1.FakeGatewayV1beta1{Fake: &c.Fake} } + +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/register.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/register.go index 8a82c1577..e3296a9cb 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/register.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/fake/register.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -34,6 +35,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ gatewayv1alpha2.AddToScheme, gatewayv1beta1.AddToScheme, + gatewayv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme/register.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme/register.go index 2b7556a4e..4d31a9ec7 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme/register.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" gatewayv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -34,6 +35,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ gatewayv1alpha2.AddToScheme, gatewayv1beta1.AddToScheme, + gatewayv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/apis_client.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/apis_client.go new file mode 100644 index 000000000..acc529114 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/apis_client.go @@ -0,0 +1,117 @@ +/* +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 ( + "net/http" + + rest "k8s.io/client-go/rest" + v1 "sigs.k8s.io/gateway-api/apis/v1" + "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +type GatewayV1Interface interface { + RESTClient() rest.Interface + GatewaysGetter + GatewayClassesGetter + HTTPRoutesGetter +} + +// GatewayV1Client is used to interact with features provided by the gateway.networking.k8s.io group. +type GatewayV1Client struct { + restClient rest.Interface +} + +func (c *GatewayV1Client) Gateways(namespace string) GatewayInterface { + return newGateways(c, namespace) +} + +func (c *GatewayV1Client) GatewayClasses() GatewayClassInterface { + return newGatewayClasses(c) +} + +func (c *GatewayV1Client) HTTPRoutes(namespace string) HTTPRouteInterface { + return newHTTPRoutes(c, namespace) +} + +// NewForConfig creates a new GatewayV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*GatewayV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new GatewayV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*GatewayV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &GatewayV1Client{client}, nil +} + +// NewForConfigOrDie creates a new GatewayV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *GatewayV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new GatewayV1Client for the given RESTClient. +func New(c rest.Interface) *GatewayV1Client { + return &GatewayV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *GatewayV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/doc.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/doc.go new file mode 100644 index 000000000..3af5d054f --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/doc.go @@ -0,0 +1,20 @@ +/* +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. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/doc.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/doc.go new file mode 100644 index 000000000..16f443990 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +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 has the automatically generated clients. +package fake diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_apis_client.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_apis_client.go new file mode 100644 index 000000000..290fcce3e --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_apis_client.go @@ -0,0 +1,48 @@ +/* +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 ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1 "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1" +) + +type FakeGatewayV1 struct { + *testing.Fake +} + +func (c *FakeGatewayV1) Gateways(namespace string) v1.GatewayInterface { + return &FakeGateways{c, namespace} +} + +func (c *FakeGatewayV1) GatewayClasses() v1.GatewayClassInterface { + return &FakeGatewayClasses{c} +} + +func (c *FakeGatewayV1) HTTPRoutes(namespace string) v1.HTTPRouteInterface { + return &FakeHTTPRoutes{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeGatewayV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gateway.go new file mode 100644 index 000000000..5ab4e7e18 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gateway.go @@ -0,0 +1,141 @@ +/* +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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// FakeGateways implements GatewayInterface +type FakeGateways struct { + Fake *FakeGatewayV1 + ns string +} + +var gatewaysResource = v1.SchemeGroupVersion.WithResource("gateways") + +var gatewaysKind = v1.SchemeGroupVersion.WithKind("Gateway") + +// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. +func (c *FakeGateways) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Gateway), err +} + +// List takes label and field selectors, and returns the list of Gateways that match those selectors. +func (c *FakeGateways) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GatewayList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1.GatewayList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.GatewayList{ListMeta: obj.(*v1.GatewayList).ListMeta} + for _, item := range obj.(*v1.GatewayList).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 gateways. +func (c *FakeGateways) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(gatewaysResource, c.ns, opts)) + +} + +// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *FakeGateways) Create(ctx context.Context, gateway *v1.Gateway, opts metav1.CreateOptions) (result *v1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Gateway), err +} + +// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *FakeGateways) Update(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (result *v1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Gateway), 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 *FakeGateways) UpdateStatus(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (*v1.Gateway, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(gatewaysResource, "status", c.ns, gateway), &v1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Gateway), err +} + +// Delete takes name of the gateway and deletes it. Returns an error if one occurs. +func (c *FakeGateways) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(gatewaysResource, c.ns, name, opts), &v1.Gateway{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGateways) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(gatewaysResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.GatewayList{}) + return err +} + +// Patch applies the patch and returns the patched gateway. +func (c *FakeGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Gateway, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, pt, data, subresources...), &v1.Gateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Gateway), err +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gatewayclass.go new file mode 100644 index 000000000..0d85bf47a --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_gatewayclass.go @@ -0,0 +1,132 @@ +/* +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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// FakeGatewayClasses implements GatewayClassInterface +type FakeGatewayClasses struct { + Fake *FakeGatewayV1 +} + +var gatewayclassesResource = v1.SchemeGroupVersion.WithResource("gatewayclasses") + +var gatewayclassesKind = v1.SchemeGroupVersion.WithKind("GatewayClass") + +// Get takes name of the gatewayClass, and returns the corresponding gatewayClass object, and an error if there is any. +func (c *FakeGatewayClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(gatewayclassesResource, name), &v1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.GatewayClass), err +} + +// List takes label and field selectors, and returns the list of GatewayClasses that match those selectors. +func (c *FakeGatewayClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GatewayClassList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(gatewayclassesResource, gatewayclassesKind, opts), &v1.GatewayClassList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.GatewayClassList{ListMeta: obj.(*v1.GatewayClassList).ListMeta} + for _, item := range obj.(*v1.GatewayClassList).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 gatewayClasses. +func (c *FakeGatewayClasses) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(gatewayclassesResource, opts)) +} + +// Create takes the representation of a gatewayClass and creates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *FakeGatewayClasses) Create(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.CreateOptions) (result *v1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(gatewayclassesResource, gatewayClass), &v1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.GatewayClass), err +} + +// Update takes the representation of a gatewayClass and updates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *FakeGatewayClasses) Update(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (result *v1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(gatewayclassesResource, gatewayClass), &v1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.GatewayClass), 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 *FakeGatewayClasses) UpdateStatus(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (*v1.GatewayClass, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(gatewayclassesResource, "status", gatewayClass), &v1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.GatewayClass), err +} + +// Delete takes name of the gatewayClass and deletes it. Returns an error if one occurs. +func (c *FakeGatewayClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(gatewayclassesResource, name, opts), &v1.GatewayClass{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeGatewayClasses) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(gatewayclassesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.GatewayClassList{}) + return err +} + +// Patch applies the patch and returns the patched gatewayClass. +func (c *FakeGatewayClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GatewayClass, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, name, pt, data, subresources...), &v1.GatewayClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1.GatewayClass), err +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_httproute.go new file mode 100644 index 000000000..7bf864772 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_httproute.go @@ -0,0 +1,141 @@ +/* +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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// FakeHTTPRoutes implements HTTPRouteInterface +type FakeHTTPRoutes struct { + Fake *FakeGatewayV1 + ns string +} + +var httproutesResource = v1.SchemeGroupVersion.WithResource("httproutes") + +var httproutesKind = v1.SchemeGroupVersion.WithKind("HTTPRoute") + +// Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. +func (c *FakeHTTPRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(httproutesResource, c.ns, name), &v1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HTTPRoute), err +} + +// List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. +func (c *FakeHTTPRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HTTPRouteList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(httproutesResource, httproutesKind, c.ns, opts), &v1.HTTPRouteList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.HTTPRouteList{ListMeta: obj.(*v1.HTTPRouteList).ListMeta} + for _, item := range obj.(*v1.HTTPRouteList).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 hTTPRoutes. +func (c *FakeHTTPRoutes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(httproutesResource, c.ns, opts)) + +} + +// Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *FakeHTTPRoutes) Create(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.CreateOptions) (result *v1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(httproutesResource, c.ns, hTTPRoute), &v1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HTTPRoute), err +} + +// Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *FakeHTTPRoutes) Update(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(httproutesResource, c.ns, hTTPRoute), &v1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HTTPRoute), 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 *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (*v1.HTTPRoute, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(httproutesResource, "status", c.ns, hTTPRoute), &v1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HTTPRoute), err +} + +// Delete takes name of the hTTPRoute and deletes it. Returns an error if one occurs. +func (c *FakeHTTPRoutes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(httproutesResource, c.ns, name, opts), &v1.HTTPRoute{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewDeleteCollectionAction(httproutesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1.HTTPRouteList{}) + return err +} + +// Patch applies the patch and returns the patched hTTPRoute. +func (c *FakeHTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HTTPRoute, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, name, pt, data, subresources...), &v1.HTTPRoute{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.HTTPRoute), err +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gateway.go new file mode 100644 index 000000000..37a78cfce --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gateway.go @@ -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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "sigs.k8s.io/gateway-api/apis/v1" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// GatewaysGetter has a method to return a GatewayInterface. +// A group's client should implement this interface. +type GatewaysGetter interface { + Gateways(namespace string) GatewayInterface +} + +// GatewayInterface has methods to work with Gateway resources. +type GatewayInterface interface { + Create(ctx context.Context, gateway *v1.Gateway, opts metav1.CreateOptions) (*v1.Gateway, error) + Update(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (*v1.Gateway, error) + UpdateStatus(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (*v1.Gateway, 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.Gateway, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.GatewayList, 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.Gateway, err error) + GatewayExpansion +} + +// gateways implements GatewayInterface +type gateways struct { + client rest.Interface + ns string +} + +// newGateways returns a Gateways +func newGateways(c *GatewayV1Client, namespace string) *gateways { + return &gateways{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the gateway, and returns the corresponding gateway object, and an error if there is any. +func (c *gateways) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Gateway, err error) { + result = &v1.Gateway{} + err = c.client.Get(). + Namespace(c.ns). + Resource("gateways"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Gateways that match those selectors. +func (c *gateways) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GatewayList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.GatewayList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("gateways"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested gateways. +func (c *gateways) 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("gateways"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a gateway and creates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *gateways) Create(ctx context.Context, gateway *v1.Gateway, opts metav1.CreateOptions) (result *v1.Gateway, err error) { + result = &v1.Gateway{} + err = c.client.Post(). + Namespace(c.ns). + Resource("gateways"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gateway). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a gateway and updates it. Returns the server's representation of the gateway, and an error, if there is any. +func (c *gateways) Update(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (result *v1.Gateway, err error) { + result = &v1.Gateway{} + err = c.client.Put(). + Namespace(c.ns). + Resource("gateways"). + Name(gateway.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gateway). + 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 *gateways) UpdateStatus(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (result *v1.Gateway, err error) { + result = &v1.Gateway{} + err = c.client.Put(). + Namespace(c.ns). + Resource("gateways"). + Name(gateway.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gateway). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the gateway and deletes it. Returns an error if one occurs. +func (c *gateways) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("gateways"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *gateways) 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("gateways"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched gateway. +func (c *gateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Gateway, err error) { + result = &v1.Gateway{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("gateways"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gatewayclass.go new file mode 100644 index 000000000..929bd9d2d --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/gatewayclass.go @@ -0,0 +1,184 @@ +/* +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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "sigs.k8s.io/gateway-api/apis/v1" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// GatewayClassesGetter has a method to return a GatewayClassInterface. +// A group's client should implement this interface. +type GatewayClassesGetter interface { + GatewayClasses() GatewayClassInterface +} + +// GatewayClassInterface has methods to work with GatewayClass resources. +type GatewayClassInterface interface { + Create(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.CreateOptions) (*v1.GatewayClass, error) + Update(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (*v1.GatewayClass, error) + UpdateStatus(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (*v1.GatewayClass, 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.GatewayClass, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.GatewayClassList, 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.GatewayClass, err error) + GatewayClassExpansion +} + +// gatewayClasses implements GatewayClassInterface +type gatewayClasses struct { + client rest.Interface +} + +// newGatewayClasses returns a GatewayClasses +func newGatewayClasses(c *GatewayV1Client) *gatewayClasses { + return &gatewayClasses{ + client: c.RESTClient(), + } +} + +// Get takes name of the gatewayClass, and returns the corresponding gatewayClass object, and an error if there is any. +func (c *gatewayClasses) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GatewayClass, err error) { + result = &v1.GatewayClass{} + err = c.client.Get(). + Resource("gatewayclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of GatewayClasses that match those selectors. +func (c *gatewayClasses) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GatewayClassList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.GatewayClassList{} + err = c.client.Get(). + Resource("gatewayclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested gatewayClasses. +func (c *gatewayClasses) 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("gatewayclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a gatewayClass and creates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *gatewayClasses) Create(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.CreateOptions) (result *v1.GatewayClass, err error) { + result = &v1.GatewayClass{} + err = c.client.Post(). + Resource("gatewayclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gatewayClass). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a gatewayClass and updates it. Returns the server's representation of the gatewayClass, and an error, if there is any. +func (c *gatewayClasses) Update(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (result *v1.GatewayClass, err error) { + result = &v1.GatewayClass{} + err = c.client.Put(). + Resource("gatewayclasses"). + Name(gatewayClass.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gatewayClass). + 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 *gatewayClasses) UpdateStatus(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (result *v1.GatewayClass, err error) { + result = &v1.GatewayClass{} + err = c.client.Put(). + Resource("gatewayclasses"). + Name(gatewayClass.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(gatewayClass). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the gatewayClass and deletes it. Returns an error if one occurs. +func (c *gatewayClasses) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("gatewayclasses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *gatewayClasses) 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("gatewayclasses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched gatewayClass. +func (c *gatewayClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GatewayClass, err error) { + result = &v1.GatewayClass{} + err = c.client.Patch(pt). + Resource("gatewayclasses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/generated_expansion.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/generated_expansion.go new file mode 100644 index 000000000..bf1da7c1a --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/generated_expansion.go @@ -0,0 +1,25 @@ +/* +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 + +type GatewayExpansion interface{} + +type GatewayClassExpansion interface{} + +type HTTPRouteExpansion interface{} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/httproute.go new file mode 100644 index 000000000..612593450 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/httproute.go @@ -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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1 "sigs.k8s.io/gateway-api/apis/v1" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// HTTPRoutesGetter has a method to return a HTTPRouteInterface. +// A group's client should implement this interface. +type HTTPRoutesGetter interface { + HTTPRoutes(namespace string) HTTPRouteInterface +} + +// HTTPRouteInterface has methods to work with HTTPRoute resources. +type HTTPRouteInterface interface { + Create(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.CreateOptions) (*v1.HTTPRoute, error) + Update(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (*v1.HTTPRoute, error) + UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (*v1.HTTPRoute, 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.HTTPRoute, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.HTTPRouteList, 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.HTTPRoute, err error) + HTTPRouteExpansion +} + +// hTTPRoutes implements HTTPRouteInterface +type hTTPRoutes struct { + client rest.Interface + ns string +} + +// newHTTPRoutes returns a HTTPRoutes +func newHTTPRoutes(c *GatewayV1Client, namespace string) *hTTPRoutes { + return &hTTPRoutes{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the hTTPRoute, and returns the corresponding hTTPRoute object, and an error if there is any. +func (c *hTTPRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.HTTPRoute, err error) { + result = &v1.HTTPRoute{} + err = c.client.Get(). + Namespace(c.ns). + Resource("httproutes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of HTTPRoutes that match those selectors. +func (c *hTTPRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.HTTPRouteList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.HTTPRouteList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("httproutes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested hTTPRoutes. +func (c *hTTPRoutes) 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("httproutes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a hTTPRoute and creates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *hTTPRoutes) Create(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.CreateOptions) (result *v1.HTTPRoute, err error) { + result = &v1.HTTPRoute{} + err = c.client.Post(). + Namespace(c.ns). + Resource("httproutes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hTTPRoute). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a hTTPRoute and updates it. Returns the server's representation of the hTTPRoute, and an error, if there is any. +func (c *hTTPRoutes) Update(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { + result = &v1.HTTPRoute{} + err = c.client.Put(). + Namespace(c.ns). + Resource("httproutes"). + Name(hTTPRoute.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hTTPRoute). + 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 *hTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { + result = &v1.HTTPRoute{} + err = c.client.Put(). + Namespace(c.ns). + Resource("httproutes"). + Name(hTTPRoute.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(hTTPRoute). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the hTTPRoute and deletes it. Returns an error if one occurs. +func (c *hTTPRoutes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("httproutes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *hTTPRoutes) 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("httproutes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched hTTPRoute. +func (c *hTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.HTTPRoute, err error) { + result = &v1.HTTPRoute{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("httproutes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go index 165c88af9..736b827cf 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/apis_client.go @@ -28,6 +28,7 @@ import ( type GatewayV1alpha2Interface interface { RESTClient() rest.Interface + BackendTLSPoliciesGetter GRPCRoutesGetter GatewaysGetter GatewayClassesGetter @@ -43,6 +44,10 @@ type GatewayV1alpha2Client struct { restClient rest.Interface } +func (c *GatewayV1alpha2Client) BackendTLSPolicies(namespace string) BackendTLSPolicyInterface { + return newBackendTLSPolicies(c, namespace) +} + func (c *GatewayV1alpha2Client) GRPCRoutes(namespace string) GRPCRouteInterface { return newGRPCRoutes(c, namespace) } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtlspolicy.go new file mode 100644 index 000000000..73b666988 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendtlspolicy.go @@ -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 v1alpha2 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" +) + +// BackendTLSPoliciesGetter has a method to return a BackendTLSPolicyInterface. +// A group's client should implement this interface. +type BackendTLSPoliciesGetter interface { + BackendTLSPolicies(namespace string) BackendTLSPolicyInterface +} + +// BackendTLSPolicyInterface has methods to work with BackendTLSPolicy resources. +type BackendTLSPolicyInterface interface { + Create(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.CreateOptions) (*v1alpha2.BackendTLSPolicy, error) + Update(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendTLSPolicy, error) + UpdateStatus(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendTLSPolicy, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha2.BackendTLSPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.BackendTLSPolicyList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendTLSPolicy, err error) + BackendTLSPolicyExpansion +} + +// backendTLSPolicies implements BackendTLSPolicyInterface +type backendTLSPolicies struct { + client rest.Interface + ns string +} + +// newBackendTLSPolicies returns a BackendTLSPolicies +func newBackendTLSPolicies(c *GatewayV1alpha2Client, namespace string) *backendTLSPolicies { + return &backendTLSPolicies{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the backendTLSPolicy, and returns the corresponding backendTLSPolicy object, and an error if there is any. +func (c *backendTLSPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + result = &v1alpha2.BackendTLSPolicy{} + err = c.client.Get(). + Namespace(c.ns). + Resource("backendtlspolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BackendTLSPolicies that match those selectors. +func (c *backendTLSPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendTLSPolicyList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha2.BackendTLSPolicyList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("backendtlspolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested backendTLSPolicies. +func (c *backendTLSPolicies) Watch(ctx context.Context, opts v1.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("backendtlspolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a backendTLSPolicy and creates it. Returns the server's representation of the backendTLSPolicy, and an error, if there is any. +func (c *backendTLSPolicies) Create(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + result = &v1alpha2.BackendTLSPolicy{} + err = c.client.Post(). + Namespace(c.ns). + Resource("backendtlspolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(backendTLSPolicy). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a backendTLSPolicy and updates it. Returns the server's representation of the backendTLSPolicy, and an error, if there is any. +func (c *backendTLSPolicies) Update(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + result = &v1alpha2.BackendTLSPolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("backendtlspolicies"). + Name(backendTLSPolicy.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(backendTLSPolicy). + 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 *backendTLSPolicies) UpdateStatus(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + result = &v1alpha2.BackendTLSPolicy{} + err = c.client.Put(). + Namespace(c.ns). + Resource("backendtlspolicies"). + Name(backendTLSPolicy.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(backendTLSPolicy). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the backendTLSPolicy and deletes it. Returns an error if one occurs. +func (c *backendTLSPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("backendtlspolicies"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *backendTLSPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.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("backendtlspolicies"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched backendTLSPolicy. +func (c *backendTLSPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendTLSPolicy, err error) { + result = &v1alpha2.BackendTLSPolicy{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("backendtlspolicies"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go index 0f5e66d85..08b78999d 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_apis_client.go @@ -28,6 +28,10 @@ type FakeGatewayV1alpha2 struct { *testing.Fake } +func (c *FakeGatewayV1alpha2) BackendTLSPolicies(namespace string) v1alpha2.BackendTLSPolicyInterface { + return &FakeBackendTLSPolicies{c, namespace} +} + func (c *FakeGatewayV1alpha2) GRPCRoutes(namespace string) v1alpha2.GRPCRouteInterface { return &FakeGRPCRoutes{c, namespace} } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtlspolicy.go new file mode 100644 index 000000000..ad40c9e74 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendtlspolicy.go @@ -0,0 +1,141 @@ +/* +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" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// FakeBackendTLSPolicies implements BackendTLSPolicyInterface +type FakeBackendTLSPolicies struct { + Fake *FakeGatewayV1alpha2 + ns string +} + +var backendtlspoliciesResource = v1alpha2.SchemeGroupVersion.WithResource("backendtlspolicies") + +var backendtlspoliciesKind = v1alpha2.SchemeGroupVersion.WithKind("BackendTLSPolicy") + +// Get takes name of the backendTLSPolicy, and returns the corresponding backendTLSPolicy object, and an error if there is any. +func (c *FakeBackendTLSPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(backendtlspoliciesResource, c.ns, name), &v1alpha2.BackendTLSPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.BackendTLSPolicy), err +} + +// List takes label and field selectors, and returns the list of BackendTLSPolicies that match those selectors. +func (c *FakeBackendTLSPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendTLSPolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(backendtlspoliciesResource, backendtlspoliciesKind, c.ns, opts), &v1alpha2.BackendTLSPolicyList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.BackendTLSPolicyList{ListMeta: obj.(*v1alpha2.BackendTLSPolicyList).ListMeta} + for _, item := range obj.(*v1alpha2.BackendTLSPolicyList).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 backendTLSPolicies. +func (c *FakeBackendTLSPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(backendtlspoliciesResource, c.ns, opts)) + +} + +// Create takes the representation of a backendTLSPolicy and creates it. Returns the server's representation of the backendTLSPolicy, and an error, if there is any. +func (c *FakeBackendTLSPolicies) Create(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(backendtlspoliciesResource, c.ns, backendTLSPolicy), &v1alpha2.BackendTLSPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.BackendTLSPolicy), err +} + +// Update takes the representation of a backendTLSPolicy and updates it. Returns the server's representation of the backendTLSPolicy, and an error, if there is any. +func (c *FakeBackendTLSPolicies) Update(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendTLSPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(backendtlspoliciesResource, c.ns, backendTLSPolicy), &v1alpha2.BackendTLSPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.BackendTLSPolicy), 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 *FakeBackendTLSPolicies) UpdateStatus(ctx context.Context, backendTLSPolicy *v1alpha2.BackendTLSPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendTLSPolicy, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(backendtlspoliciesResource, "status", c.ns, backendTLSPolicy), &v1alpha2.BackendTLSPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.BackendTLSPolicy), err +} + +// Delete takes name of the backendTLSPolicy and deletes it. Returns an error if one occurs. +func (c *FakeBackendTLSPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(backendtlspoliciesResource, c.ns, name, opts), &v1alpha2.BackendTLSPolicy{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBackendTLSPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(backendtlspoliciesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha2.BackendTLSPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched backendTLSPolicy. +func (c *FakeBackendTLSPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendTLSPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(backendtlspoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha2.BackendTLSPolicy{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.BackendTLSPolicy), err +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go index 6de1bd3e1..d8184bc9c 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/generated_expansion.go @@ -18,6 +18,8 @@ limitations under the License. package v1alpha2 +type BackendTLSPolicyExpansion interface{} + type GRPCRouteExpansion interface{} type GatewayExpansion interface{} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/interface.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/interface.go index 7d3710708..05de6bbe3 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/interface.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/interface.go @@ -19,6 +19,7 @@ limitations under the License. package apis import ( + v1 "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1" v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2" v1beta1 "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1beta1" internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" @@ -30,6 +31,8 @@ type Interface interface { V1alpha2() v1alpha2.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface } type group struct { @@ -52,3 +55,8 @@ func (g *group) V1alpha2() v1alpha2.Interface { func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gateway.go new file mode 100644 index 000000000..640db8058 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gateway.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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1 "sigs.k8s.io/gateway-api/apis/v1" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1" +) + +// GatewayInformer provides access to a shared informer and lister for +// Gateways. +type GatewayInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.GatewayLister +} + +type gatewayInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewGatewayInformer constructs a new informer for Gateway 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 NewGatewayInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGatewayInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredGatewayInformer constructs a new informer for Gateway 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 NewFilteredGatewayInformer(client versioned.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.GatewayV1().Gateways(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1().Gateways(namespace).Watch(context.TODO(), options) + }, + }, + &apisv1.Gateway{}, + resyncPeriod, + indexers, + ) +} + +func (f *gatewayInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGatewayInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *gatewayInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1.Gateway{}, f.defaultInformer) +} + +func (f *gatewayInformer) Lister() v1.GatewayLister { + return v1.NewGatewayLister(f.Informer().GetIndexer()) +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gatewayclass.go new file mode 100644 index 000000000..4b2a2577c --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/gatewayclass.go @@ -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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1 "sigs.k8s.io/gateway-api/apis/v1" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1" +) + +// GatewayClassInformer provides access to a shared informer and lister for +// GatewayClasses. +type GatewayClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.GatewayClassLister +} + +type gatewayClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewGatewayClassInformer constructs a new informer for GatewayClass 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 NewGatewayClassInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredGatewayClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredGatewayClassInformer constructs a new informer for GatewayClass 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 NewFilteredGatewayClassInformer(client versioned.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.GatewayV1().GatewayClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1().GatewayClasses().Watch(context.TODO(), options) + }, + }, + &apisv1.GatewayClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *gatewayClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredGatewayClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *gatewayClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1.GatewayClass{}, f.defaultInformer) +} + +func (f *gatewayClassInformer) Lister() v1.GatewayClassLister { + return v1.NewGatewayClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/httproute.go new file mode 100644 index 000000000..921404311 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/httproute.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" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1 "sigs.k8s.io/gateway-api/apis/v1" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1" +) + +// HTTPRouteInformer provides access to a shared informer and lister for +// HTTPRoutes. +type HTTPRouteInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.HTTPRouteLister +} + +type hTTPRouteInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHTTPRouteInformer constructs a new informer for HTTPRoute 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 NewHTTPRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHTTPRouteInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHTTPRouteInformer constructs a new informer for HTTPRoute 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 NewFilteredHTTPRouteInformer(client versioned.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.GatewayV1().HTTPRoutes(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1().HTTPRoutes(namespace).Watch(context.TODO(), options) + }, + }, + &apisv1.HTTPRoute{}, + resyncPeriod, + indexers, + ) +} + +func (f *hTTPRouteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHTTPRouteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *hTTPRouteInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1.HTTPRoute{}, f.defaultInformer) +} + +func (f *hTTPRouteInformer) Lister() v1.HTTPRouteLister { + return v1.NewHTTPRouteLister(f.Informer().GetIndexer()) +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/interface.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/interface.go new file mode 100644 index 000000000..74c823c19 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1/interface.go @@ -0,0 +1,59 @@ +/* +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 ( + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Gateways returns a GatewayInformer. + Gateways() GatewayInformer + // GatewayClasses returns a GatewayClassInformer. + GatewayClasses() GatewayClassInformer + // HTTPRoutes returns a HTTPRouteInformer. + HTTPRoutes() HTTPRouteInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Gateways returns a GatewayInformer. +func (v *version) Gateways() GatewayInformer { + return &gatewayInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// GatewayClasses returns a GatewayClassInformer. +func (v *version) GatewayClasses() GatewayClassInformer { + return &gatewayClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// HTTPRoutes returns a HTTPRouteInformer. +func (v *version) HTTPRoutes() HTTPRouteInformer { + return &hTTPRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/backendtlspolicy.go new file mode 100644 index 000000000..2e1ac1aa7 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/backendtlspolicy.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 v1alpha2 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + versioned "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned" + internalinterfaces "sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/internalinterfaces" + v1alpha2 "sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2" +) + +// BackendTLSPolicyInformer provides access to a shared informer and lister for +// BackendTLSPolicies. +type BackendTLSPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.BackendTLSPolicyLister +} + +type backendTLSPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewBackendTLSPolicyInformer constructs a new informer for BackendTLSPolicy 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 NewBackendTLSPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBackendTLSPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredBackendTLSPolicyInformer constructs a new informer for BackendTLSPolicy 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 NewFilteredBackendTLSPolicyInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha2().BackendTLSPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.GatewayV1alpha2().BackendTLSPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &apisv1alpha2.BackendTLSPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *backendTLSPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBackendTLSPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *backendTLSPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1alpha2.BackendTLSPolicy{}, f.defaultInformer) +} + +func (f *backendTLSPolicyInformer) Lister() v1alpha2.BackendTLSPolicyLister { + return v1alpha2.NewBackendTLSPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/interface.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/interface.go index 42a9bfad0..92c95f65f 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/interface.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/apis/v1alpha2/interface.go @@ -24,6 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // BackendTLSPolicies returns a BackendTLSPolicyInformer. + BackendTLSPolicies() BackendTLSPolicyInformer // GRPCRoutes returns a GRPCRouteInformer. GRPCRoutes() GRPCRouteInformer // Gateways returns a GatewayInformer. @@ -53,6 +55,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// BackendTLSPolicies returns a BackendTLSPolicyInformer. +func (v *version) BackendTLSPolicies() BackendTLSPolicyInformer { + return &backendTLSPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // GRPCRoutes returns a GRPCRouteInformer. func (v *version) GRPCRoutes() GRPCRouteInformer { return &gRPCRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/generic.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/generic.go index ddf4bf929..20f69bf8f 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/generic.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/generic.go @@ -23,6 +23,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" + v1 "sigs.k8s.io/gateway-api/apis/v1" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -53,7 +54,17 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=gateway.networking.k8s.io, Version=v1alpha2 + // Group=gateway.networking.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("gateways"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1().Gateways().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("gatewayclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1().GatewayClasses().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("httproutes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1().HTTPRoutes().Informer()}, nil + + // Group=gateway.networking.k8s.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithResource("backendtlspolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().BackendTLSPolicies().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("grpcroutes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Gateway().V1alpha2().GRPCRoutes().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("gateways"): diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/expansion_generated.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/expansion_generated.go new file mode 100644 index 000000000..910136e21 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/expansion_generated.go @@ -0,0 +1,39 @@ +/* +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 + +// GatewayListerExpansion allows custom methods to be added to +// GatewayLister. +type GatewayListerExpansion interface{} + +// GatewayNamespaceListerExpansion allows custom methods to be added to +// GatewayNamespaceLister. +type GatewayNamespaceListerExpansion interface{} + +// GatewayClassListerExpansion allows custom methods to be added to +// GatewayClassLister. +type GatewayClassListerExpansion interface{} + +// HTTPRouteListerExpansion allows custom methods to be added to +// HTTPRouteLister. +type HTTPRouteListerExpansion interface{} + +// HTTPRouteNamespaceListerExpansion allows custom methods to be added to +// HTTPRouteNamespaceLister. +type HTTPRouteNamespaceListerExpansion interface{} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gateway.go new file mode 100644 index 000000000..82a886c86 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gateway.go @@ -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 ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// GatewayLister helps list Gateways. +// All objects returned here must be treated as read-only. +type GatewayLister interface { + // List lists all Gateways in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Gateway, err error) + // Gateways returns an object that can list and get Gateways. + Gateways(namespace string) GatewayNamespaceLister + GatewayListerExpansion +} + +// gatewayLister implements the GatewayLister interface. +type gatewayLister struct { + indexer cache.Indexer +} + +// NewGatewayLister returns a new GatewayLister. +func NewGatewayLister(indexer cache.Indexer) GatewayLister { + return &gatewayLister{indexer: indexer} +} + +// List lists all Gateways in the indexer. +func (s *gatewayLister) List(selector labels.Selector) (ret []*v1.Gateway, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Gateway)) + }) + return ret, err +} + +// Gateways returns an object that can list and get Gateways. +func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { + return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// GatewayNamespaceLister helps list and get Gateways. +// All objects returned here must be treated as read-only. +type GatewayNamespaceLister interface { + // List lists all Gateways in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Gateway, err error) + // Get retrieves the Gateway from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Gateway, error) + GatewayNamespaceListerExpansion +} + +// gatewayNamespaceLister implements the GatewayNamespaceLister +// interface. +type gatewayNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Gateways in the indexer for a given namespace. +func (s gatewayNamespaceLister) List(selector labels.Selector) (ret []*v1.Gateway, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Gateway)) + }) + return ret, err +} + +// Get retrieves the Gateway from the indexer for a given namespace and name. +func (s gatewayNamespaceLister) Get(name string) (*v1.Gateway, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("gateway"), name) + } + return obj.(*v1.Gateway), nil +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gatewayclass.go new file mode 100644 index 000000000..e3ddf47e2 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/gatewayclass.go @@ -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 ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// GatewayClassLister helps list GatewayClasses. +// All objects returned here must be treated as read-only. +type GatewayClassLister interface { + // List lists all GatewayClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.GatewayClass, err error) + // Get retrieves the GatewayClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.GatewayClass, error) + GatewayClassListerExpansion +} + +// gatewayClassLister implements the GatewayClassLister interface. +type gatewayClassLister struct { + indexer cache.Indexer +} + +// NewGatewayClassLister returns a new GatewayClassLister. +func NewGatewayClassLister(indexer cache.Indexer) GatewayClassLister { + return &gatewayClassLister{indexer: indexer} +} + +// List lists all GatewayClasses in the indexer. +func (s *gatewayClassLister) List(selector labels.Selector) (ret []*v1.GatewayClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.GatewayClass)) + }) + return ret, err +} + +// Get retrieves the GatewayClass from the index for a given name. +func (s *gatewayClassLister) Get(name string) (*v1.GatewayClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("gatewayclass"), name) + } + return obj.(*v1.GatewayClass), nil +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/httproute.go new file mode 100644 index 000000000..edf16efc5 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/httproute.go @@ -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 ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// HTTPRouteLister helps list HTTPRoutes. +// All objects returned here must be treated as read-only. +type HTTPRouteLister interface { + // List lists all HTTPRoutes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HTTPRoute, err error) + // HTTPRoutes returns an object that can list and get HTTPRoutes. + HTTPRoutes(namespace string) HTTPRouteNamespaceLister + HTTPRouteListerExpansion +} + +// hTTPRouteLister implements the HTTPRouteLister interface. +type hTTPRouteLister struct { + indexer cache.Indexer +} + +// NewHTTPRouteLister returns a new HTTPRouteLister. +func NewHTTPRouteLister(indexer cache.Indexer) HTTPRouteLister { + return &hTTPRouteLister{indexer: indexer} +} + +// List lists all HTTPRoutes in the indexer. +func (s *hTTPRouteLister) List(selector labels.Selector) (ret []*v1.HTTPRoute, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HTTPRoute)) + }) + return ret, err +} + +// HTTPRoutes returns an object that can list and get HTTPRoutes. +func (s *hTTPRouteLister) HTTPRoutes(namespace string) HTTPRouteNamespaceLister { + return hTTPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HTTPRouteNamespaceLister helps list and get HTTPRoutes. +// All objects returned here must be treated as read-only. +type HTTPRouteNamespaceLister interface { + // List lists all HTTPRoutes in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HTTPRoute, err error) + // Get retrieves the HTTPRoute from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.HTTPRoute, error) + HTTPRouteNamespaceListerExpansion +} + +// hTTPRouteNamespaceLister implements the HTTPRouteNamespaceLister +// interface. +type hTTPRouteNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HTTPRoutes in the indexer for a given namespace. +func (s hTTPRouteNamespaceLister) List(selector labels.Selector) (ret []*v1.HTTPRoute, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HTTPRoute)) + }) + return ret, err +} + +// Get retrieves the HTTPRoute from the indexer for a given namespace and name. +func (s hTTPRouteNamespaceLister) Get(name string) (*v1.HTTPRoute, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("httproute"), name) + } + return obj.(*v1.HTTPRoute), nil +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendtlspolicy.go new file mode 100644 index 000000000..f5927ef19 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendtlspolicy.go @@ -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 v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// BackendTLSPolicyLister helps list BackendTLSPolicies. +// All objects returned here must be treated as read-only. +type BackendTLSPolicyLister interface { + // List lists all BackendTLSPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.BackendTLSPolicy, err error) + // BackendTLSPolicies returns an object that can list and get BackendTLSPolicies. + BackendTLSPolicies(namespace string) BackendTLSPolicyNamespaceLister + BackendTLSPolicyListerExpansion +} + +// backendTLSPolicyLister implements the BackendTLSPolicyLister interface. +type backendTLSPolicyLister struct { + indexer cache.Indexer +} + +// NewBackendTLSPolicyLister returns a new BackendTLSPolicyLister. +func NewBackendTLSPolicyLister(indexer cache.Indexer) BackendTLSPolicyLister { + return &backendTLSPolicyLister{indexer: indexer} +} + +// List lists all BackendTLSPolicies in the indexer. +func (s *backendTLSPolicyLister) List(selector labels.Selector) (ret []*v1alpha2.BackendTLSPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.BackendTLSPolicy)) + }) + return ret, err +} + +// BackendTLSPolicies returns an object that can list and get BackendTLSPolicies. +func (s *backendTLSPolicyLister) BackendTLSPolicies(namespace string) BackendTLSPolicyNamespaceLister { + return backendTLSPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// BackendTLSPolicyNamespaceLister helps list and get BackendTLSPolicies. +// All objects returned here must be treated as read-only. +type BackendTLSPolicyNamespaceLister interface { + // List lists all BackendTLSPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.BackendTLSPolicy, err error) + // Get retrieves the BackendTLSPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha2.BackendTLSPolicy, error) + BackendTLSPolicyNamespaceListerExpansion +} + +// backendTLSPolicyNamespaceLister implements the BackendTLSPolicyNamespaceLister +// interface. +type backendTLSPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all BackendTLSPolicies in the indexer for a given namespace. +func (s backendTLSPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.BackendTLSPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.BackendTLSPolicy)) + }) + return ret, err +} + +// Get retrieves the BackendTLSPolicy from the indexer for a given namespace and name. +func (s backendTLSPolicyNamespaceLister) Get(name string) (*v1alpha2.BackendTLSPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("backendtlspolicy"), name) + } + return obj.(*v1alpha2.BackendTLSPolicy), nil +} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/expansion_generated.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/expansion_generated.go index f41ca7336..b2d81f338 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/expansion_generated.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/expansion_generated.go @@ -18,6 +18,14 @@ limitations under the License. package v1alpha2 +// BackendTLSPolicyListerExpansion allows custom methods to be added to +// BackendTLSPolicyLister. +type BackendTLSPolicyListerExpansion interface{} + +// BackendTLSPolicyNamespaceListerExpansion allows custom methods to be added to +// BackendTLSPolicyNamespaceLister. +type BackendTLSPolicyNamespaceListerExpansion interface{} + // GRPCRouteListerExpansion allows custom methods to be added to // GRPCRouteLister. type GRPCRouteListerExpansion interface{}