diff --git a/go.mod b/go.mod index 631969a0ad..067f0cc9a3 100644 --- a/go.mod +++ b/go.mod @@ -15,18 +15,18 @@ require ( github.com/prometheus/client_golang v1.19.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.2 google.golang.org/protobuf v1.34.2 - k8s.io/api v0.31.0 - k8s.io/apimachinery v0.31.0 + k8s.io/api v0.31.1 + k8s.io/apimachinery v0.31.1 k8s.io/apiserver v0.31.0 - k8s.io/client-go v0.31.0 + k8s.io/client-go v0.31.1 k8s.io/component-base v0.31.0 k8s.io/component-helpers v0.31.0 k8s.io/csi-translation-lib v0.31.0 k8s.io/klog/v2 v2.130.1 - sigs.k8s.io/controller-runtime v0.19.0 - sigs.k8s.io/gateway-api v1.1.0 + sigs.k8s.io/controller-runtime v0.19.1 + sigs.k8s.io/gateway-api v1.2.0 sigs.k8s.io/sig-storage-lib-external-provisioner/v10 v10.0.1 ) @@ -34,7 +34,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/onsi/ginkgo/v2 v2.20.0 github.com/onsi/gomega v1.34.1 - k8s.io/kubernetes v1.31.0 + k8s.io/kubernetes v1.31.2 ) require ( @@ -113,7 +113,7 @@ require ( golang.org/x/net v0.28.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.6.0 // indirect @@ -126,7 +126,7 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.31.0 // indirect + k8s.io/apiextensions-apiserver v0.31.1 // indirect k8s.io/cloud-provider v0.30.0 // indirect k8s.io/controller-manager v0.31.0 // indirect k8s.io/kms v0.31.0 // indirect @@ -136,9 +136,9 @@ require ( k8s.io/mount-utils v0.31.0 // indirect k8s.io/pod-security-admission v0.31.0 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index f96f488215..e7dfc1ff3d 100644 --- a/go.sum +++ b/go.sum @@ -265,8 +265,8 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= @@ -293,8 +293,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -306,7 +306,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -342,25 +341,25 @@ k8s.io/kubectl v0.31.0 h1:kANwAAPVY02r4U4jARP/C+Q1sssCcN/1p9Nk+7BQKVg= k8s.io/kubectl v0.31.0/go.mod h1:pB47hhFypGsaHAPjlwrNbvhXgmuAr01ZBvAIIUaI8d4= k8s.io/kubelet v0.31.0 h1:IlfkBy7QTojGEm97GuVGhtli0HL/Pgu4AdayiF76yWo= k8s.io/kubelet v0.31.0/go.mod h1:s+OnqnfdIh14PFpUb7NgzM53WSYXcczA3w/1qSzsRc8= -k8s.io/kubernetes v1.31.0 h1:sYAB12TTWexXKp4RxqJMm/7EC+P0mNOgn4Xdj5eu7HM= -k8s.io/kubernetes v1.31.0/go.mod h1:UTpGn7nxrUrPWw5hNIYTAjodcWIvLakgHpLtfrr6GC8= +k8s.io/kubernetes v1.31.2 h1:VNSu4O7Xn5FFRsh9ePXyEPg6ucR21fOftarSdi053Gs= +k8s.io/kubernetes v1.31.2/go.mod h1:9xmT2buyTYj8TRKwRae7FcuY8k5+xlxv7VivvO0KKfs= k8s.io/mount-utils v0.31.0 h1:o+a+n6gyZ7MGc6bIERU3LeFTHbLDBiVReaDpWlJotUE= k8s.io/mount-utils v0.31.0/go.mod h1:HV/VYBUGqYUj4vt82YltzpWvgv8FPg0G9ItyInT3NPU= k8s.io/pod-security-admission v0.31.0 h1:z8lTQ1+EZ8aX+xTrDTT2Udt1b9mzci2o2L2O4TUWSUU= k8s.io/pod-security-admission v0.31.0/go.mod h1:672PutRBAIEOJJljOHDYhXiXrQDDFdB3z7hddN3Pv5c= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= -sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= -sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM= -sigs.k8s.io/gateway-api v1.1.0/go.mod h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/controller-runtime v0.19.1 h1:Son+Q40+Be3QWb+niBXAg2vFiYWolDjjRfO8hn/cxOk= +sigs.k8s.io/controller-runtime v0.19.1/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/gateway-api v1.2.0 h1:LrToiFwtqKTKZcZtoQPTuo3FxhrrhTgzQG0Te+YGSo8= +sigs.k8s.io/gateway-api v1.2.0/go.mod h1:EpNfEXNjiYfUJypf0eZ0P5iXA9ekSGWaS1WgPaM42X0= 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/sig-storage-lib-external-provisioner/v10 v10.0.1 h1:uhd7RobUnVmfkRb3gkYQh4tBOiBEBvdwW/nAthG95Rc= sigs.k8s.io/sig-storage-lib-external-provisioner/v10 v10.0.1/go.mod h1:mfQ2enu5yAHUhpNWsce9NmkqkRQsk70zQT+7KjZ+JMo= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index b102b95a0a..7f1961b907 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -3807,6 +3807,9 @@ const ( ETHTOOL_MSG_PSE_GET_REPLY = 0x25 ETHTOOL_MSG_RSS_GET_REPLY = 0x26 ETHTOOL_MSG_KERNEL_MAX = 0x2b + ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 + ETHTOOL_FLAG_OMIT_REPLY = 0x2 + ETHTOOL_FLAG_STATS = 0x4 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 4d0c15745f..3f03b3d57c 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -2031,6 +2031,50 @@ const ( IF_TYPE_IEEE1394 = 144 ) +// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin +const ( + IpPrefixOriginOther = 0 + IpPrefixOriginManual = 1 + IpPrefixOriginWellKnown = 2 + IpPrefixOriginDhcp = 3 + IpPrefixOriginRouterAdvertisement = 4 + IpPrefixOriginUnchanged = 1 << 4 +) + +// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin +const ( + NlsoOther = 0 + NlsoManual = 1 + NlsoWellKnown = 2 + NlsoDhcp = 3 + NlsoLinkLayerAddress = 4 + NlsoRandom = 5 + IpSuffixOriginOther = 0 + IpSuffixOriginManual = 1 + IpSuffixOriginWellKnown = 2 + IpSuffixOriginDhcp = 3 + IpSuffixOriginLinkLayerAddress = 4 + IpSuffixOriginRandom = 5 + IpSuffixOriginUnchanged = 1 << 4 +) + +// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see +// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state +const ( + NldsInvalid = 0 + NldsTentative = 1 + NldsDuplicate = 2 + NldsDeprecated = 3 + NldsPreferred = 4 + IpDadStateInvalid = 0 + IpDadStateTentative = 1 + IpDadStateDuplicate = 2 + IpDadStateDeprecated = 3 + IpDadStatePreferred = 4 +) + type SocketAddress struct { Sockaddr *syscall.RawSockaddrAny SockaddrLength int32 diff --git a/vendor/google.golang.org/grpc/MAINTAINERS.md b/vendor/google.golang.org/grpc/MAINTAINERS.md index 6a8a07781a..5d4096d46a 100644 --- a/vendor/google.golang.org/grpc/MAINTAINERS.md +++ b/vendor/google.golang.org/grpc/MAINTAINERS.md @@ -9,21 +9,28 @@ for general contribution guidelines. ## Maintainers (in alphabetical order) +- [aranjans](https://github.com/aranjans), Google LLC +- [arjan-bal](https://github.com/arjan-bal), Google LLC +- [arvindbr8](https://github.com/arvindbr8), Google LLC - [atollena](https://github.com/atollena), Datadog, Inc. -- [cesarghali](https://github.com/cesarghali), Google LLC - [dfawley](https://github.com/dfawley), Google LLC - [easwars](https://github.com/easwars), Google LLC -- [menghanl](https://github.com/menghanl), Google LLC -- [srini100](https://github.com/srini100), Google LLC +- [erm-g](https://github.com/erm-g), Google LLC +- [gtcooke94](https://github.com/gtcooke94), Google LLC +- [purnesh42h](https://github.com/purnesh42h), Google LLC +- [zasweq](https://github.com/zasweq), Google LLC ## Emeritus Maintainers (in alphabetical order) -- [adelez](https://github.com/adelez), Google LLC -- [canguler](https://github.com/canguler), Google LLC -- [iamqizhao](https://github.com/iamqizhao), Google LLC -- [jadekler](https://github.com/jadekler), Google LLC -- [jtattermusch](https://github.com/jtattermusch), Google LLC -- [lyuxuan](https://github.com/lyuxuan), Google LLC -- [makmukhi](https://github.com/makmukhi), Google LLC -- [matt-kwong](https://github.com/matt-kwong), Google LLC -- [nicolasnoble](https://github.com/nicolasnoble), Google LLC -- [yongni](https://github.com/yongni), Google LLC +- [adelez](https://github.com/adelez) +- [canguler](https://github.com/canguler) +- [cesarghali](https://github.com/cesarghali) +- [iamqizhao](https://github.com/iamqizhao) +- [jeanbza](https://github.com/jeanbza) +- [jtattermusch](https://github.com/jtattermusch) +- [lyuxuan](https://github.com/lyuxuan) +- [makmukhi](https://github.com/makmukhi) +- [matt-kwong](https://github.com/matt-kwong) +- [menghanl](https://github.com/menghanl) +- [nicolasnoble](https://github.com/nicolasnoble) +- [srini100](https://github.com/srini100) +- [yongni](https://github.com/yongni) diff --git a/vendor/google.golang.org/grpc/SECURITY.md b/vendor/google.golang.org/grpc/SECURITY.md index be6e108705..abab279379 100644 --- a/vendor/google.golang.org/grpc/SECURITY.md +++ b/vendor/google.golang.org/grpc/SECURITY.md @@ -1,3 +1,3 @@ # Security Policy -For information on gRPC Security Policy and reporting potentional security issues, please see [gRPC CVE Process](https://github.com/grpc/proposal/blob/master/P4-grpc-cve-process.md). +For information on gRPC Security Policy and reporting potential security issues, please see [gRPC CVE Process](https://github.com/grpc/proposal/blob/master/P4-grpc-cve-process.md). diff --git a/vendor/google.golang.org/grpc/backoff/backoff.go b/vendor/google.golang.org/grpc/backoff/backoff.go index 0787d0b50c..d7b40b7cb6 100644 --- a/vendor/google.golang.org/grpc/backoff/backoff.go +++ b/vendor/google.golang.org/grpc/backoff/backoff.go @@ -39,7 +39,7 @@ type Config struct { MaxDelay time.Duration } -// DefaultConfig is a backoff configuration with the default values specfied +// DefaultConfig is a backoff configuration with the default values specified // at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. // // This should be useful for callers who want to configure backoff with diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index f391744f72..b181f386a1 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -30,6 +30,7 @@ import ( "google.golang.org/grpc/channelz" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" + estats "google.golang.org/grpc/experimental/stats" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" @@ -72,8 +73,21 @@ func unregisterForTesting(name string) { delete(m, name) } +// connectedAddress returns the connected address for a SubConnState. The +// address is only valid if the state is READY. +func connectedAddress(scs SubConnState) resolver.Address { + return scs.connectedAddress +} + +// setConnectedAddress sets the connected address for a SubConnState. +func setConnectedAddress(scs *SubConnState, addr resolver.Address) { + scs.connectedAddress = addr +} + func init() { internal.BalancerUnregister = unregisterForTesting + internal.ConnectedAddress = connectedAddress + internal.SetConnectedAddress = setConnectedAddress } // Get returns the resolver builder registered with the given name. @@ -243,6 +257,10 @@ type BuildOptions struct { // same resolver.Target as passed to the resolver. See the documentation for // the resolver.Target type for details about what it contains. Target resolver.Target + // MetricsRecorder is the metrics recorder that balancers can use to record + // metrics. Balancer implementations which do not register metrics on + // metrics registry and record on them can ignore this field. + MetricsRecorder estats.MetricsRecorder } // Builder creates a balancer. @@ -410,6 +428,9 @@ type SubConnState struct { // ConnectionError is set if the ConnectivityState is TransientFailure, // describing the reason the SubConn failed. Otherwise, it is nil. ConnectionError error + // connectedAddr contains the connected address when ConnectivityState is + // Ready. Otherwise, it is indeterminate. + connectedAddress resolver.Address } // ClientConnState describes the state of a ClientConn relevant to the diff --git a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go index 07527603f1..5b592f48ad 100644 --- a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go @@ -155,7 +155,7 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState // Endpoints not set, process addresses until we migrate resolver // emissions fully to Endpoints. The top channel does wrap emitted // addresses with endpoints, however some balancers such as weighted - // target do not forwarrd the corresponding correct endpoints down/split + // target do not forward the corresponding correct endpoints down/split // endpoints properly. Once all balancers correctly forward endpoints // down, can delete this else conditional. addrs = state.ResolverState.Addresses diff --git a/vendor/google.golang.org/grpc/balancer_wrapper.go b/vendor/google.golang.org/grpc/balancer_wrapper.go index 4161fdf47a..6561b769eb 100644 --- a/vendor/google.golang.org/grpc/balancer_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_wrapper.go @@ -25,12 +25,15 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/balancer/gracefulswitch" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/resolver" ) +var setConnectedAddress = internal.SetConnectedAddress.(func(*balancer.SubConnState, resolver.Address)) + // ccBalancerWrapper sits between the ClientConn and the Balancer. // // ccBalancerWrapper implements methods corresponding to the ones on the @@ -79,6 +82,7 @@ func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { CustomUserAgent: cc.dopts.copts.UserAgent, ChannelzParent: cc.channelz, Target: cc.parsedTarget, + MetricsRecorder: cc.metricsRecorderList, }, serializer: grpcsync.NewCallbackSerializer(ctx), serializerCancel: cancel, @@ -92,7 +96,7 @@ func newCCBalancerWrapper(cc *ClientConn) *ccBalancerWrapper { // it is safe to call into the balancer here. func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error { errCh := make(chan error) - ok := ccb.serializer.Schedule(func(ctx context.Context) { + uccs := func(ctx context.Context) { defer close(errCh) if ctx.Err() != nil || ccb.balancer == nil { return @@ -107,17 +111,23 @@ func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnStat logger.Infof("error from balancer.UpdateClientConnState: %v", err) } errCh <- err - }) - if !ok { - return nil } + onFailure := func() { close(errCh) } + + // UpdateClientConnState can race with Close, and when the latter wins, the + // serializer is closed, and the attempt to schedule the callback will fail. + // It is acceptable to ignore this failure. But since we want to handle the + // state update in a blocking fashion (when we successfully schedule the + // callback), we have to use the ScheduleOr method and not the MaybeSchedule + // method on the serializer. + ccb.serializer.ScheduleOr(uccs, onFailure) return <-errCh } // resolverError is invoked by grpc to push a resolver error to the underlying // balancer. The call to the balancer is executed from the serializer. func (ccb *ccBalancerWrapper) resolverError(err error) { - ccb.serializer.Schedule(func(ctx context.Context) { + ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || ccb.balancer == nil { return } @@ -133,7 +143,7 @@ func (ccb *ccBalancerWrapper) close() { ccb.closed = true ccb.mu.Unlock() channelz.Info(logger, ccb.cc.channelz, "ccBalancerWrapper: closing") - ccb.serializer.Schedule(func(context.Context) { + ccb.serializer.TrySchedule(func(context.Context) { if ccb.balancer == nil { return } @@ -145,7 +155,7 @@ func (ccb *ccBalancerWrapper) close() { // exitIdle invokes the balancer's exitIdle method in the serializer. func (ccb *ccBalancerWrapper) exitIdle() { - ccb.serializer.Schedule(func(ctx context.Context) { + ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || ccb.balancer == nil { return } @@ -252,15 +262,29 @@ type acBalancerWrapper struct { // updateState is invoked by grpc to push a subConn state update to the // underlying balancer. -func (acbw *acBalancerWrapper) updateState(s connectivity.State, err error) { - acbw.ccb.serializer.Schedule(func(ctx context.Context) { +func (acbw *acBalancerWrapper) updateState(s connectivity.State, curAddr resolver.Address, err error) { + acbw.ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || acbw.ccb.balancer == nil { return } // Even though it is optional for balancers, gracefulswitch ensures // opts.StateListener is set, so this cannot ever be nil. // TODO: delete this comment when UpdateSubConnState is removed. - acbw.stateListener(balancer.SubConnState{ConnectivityState: s, ConnectionError: err}) + scs := balancer.SubConnState{ConnectivityState: s, ConnectionError: err} + if s == connectivity.Ready { + setConnectedAddress(&scs, curAddr) + } + acbw.stateListener(scs) + acbw.ac.mu.Lock() + defer acbw.ac.mu.Unlock() + if s == connectivity.Ready { + // When changing states to READY, reset stateReadyChan. Wait until + // after we notify the LB policy's listener(s) in order to prevent + // ac.getTransport() from unblocking before the LB policy starts + // tracking the subchannel as READY. + close(acbw.ac.stateReadyChan) + acbw.ac.stateReadyChan = make(chan struct{}) + } }) } diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index 63c639e4fe..fcd1cfe802 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -19,7 +19,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc v5.27.1 // source: grpc/binlog/v1/binarylog.proto package grpc_binarylog_v1 diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 423be7b43b..9c8850e3fd 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -24,6 +24,7 @@ import ( "fmt" "math" "net/url" + "slices" "strings" "sync" "sync/atomic" @@ -39,6 +40,7 @@ import ( "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/idle" iresolver "google.golang.org/grpc/internal/resolver" + "google.golang.org/grpc/internal/stats" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" @@ -194,8 +196,11 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error) cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelz) cc.pickerWrapper = newPickerWrapper(cc.dopts.copts.StatsHandlers) + cc.metricsRecorderList = stats.NewMetricsRecorderList(cc.dopts.copts.StatsHandlers) + cc.initIdleStateLocked() // Safe to call without the lock, since nothing else has a reference to cc. cc.idlenessMgr = idle.NewManager((*idler)(cc), cc.dopts.idleTimeout) + return cc, nil } @@ -590,13 +595,14 @@ type ClientConn struct { cancel context.CancelFunc // Cancelled on close. // The following are initialized at dial time, and are read-only after that. - target string // User's dial target. - parsedTarget resolver.Target // See initParsedTargetAndResolverBuilder(). - authority string // See initAuthority(). - dopts dialOptions // Default and user specified dial options. - channelz *channelz.Channel // Channelz object. - resolverBuilder resolver.Builder // See initParsedTargetAndResolverBuilder(). - idlenessMgr *idle.Manager + target string // User's dial target. + parsedTarget resolver.Target // See initParsedTargetAndResolverBuilder(). + authority string // See initAuthority(). + dopts dialOptions // Default and user specified dial options. + channelz *channelz.Channel // Channelz object. + resolverBuilder resolver.Builder // See initParsedTargetAndResolverBuilder(). + idlenessMgr *idle.Manager + metricsRecorderList *stats.MetricsRecorderList // The following provide their own synchronization, and therefore don't // require cc.mu to be held to access them. @@ -626,11 +632,6 @@ type ClientConn struct { // WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or // ctx expires. A true value is returned in former case and false in latter. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connectivity.State) bool { ch := cc.csMgr.getNotifyChan() if cc.csMgr.getState() != sourceState { @@ -645,11 +646,6 @@ func (cc *ClientConn) WaitForStateChange(ctx context.Context, sourceState connec } // GetState returns the connectivity.State of ClientConn. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a later -// release. func (cc *ClientConn) GetState() connectivity.State { return cc.csMgr.getState() } @@ -812,17 +808,11 @@ func (cc *ClientConn) applyFailingLBLocked(sc *serviceconfig.ParseResult) { cc.csMgr.updateState(connectivity.TransientFailure) } -// Makes a copy of the input addresses slice and clears out the balancer -// attributes field. Addresses are passed during subconn creation and address -// update operations. In both cases, we will clear the balancer attributes by -// calling this function, and therefore we will be able to use the Equal method -// provided by the resolver.Address type for comparison. -func copyAddressesWithoutBalancerAttributes(in []resolver.Address) []resolver.Address { +// Makes a copy of the input addresses slice. Addresses are passed during +// subconn creation and address update operations. +func copyAddresses(in []resolver.Address) []resolver.Address { out := make([]resolver.Address, len(in)) - for i := range in { - out[i] = in[i] - out[i].BalancerAttributes = nil - } + copy(out, in) return out } @@ -835,14 +825,14 @@ func (cc *ClientConn) newAddrConnLocked(addrs []resolver.Address, opts balancer. } ac := &addrConn{ - state: connectivity.Idle, - cc: cc, - addrs: copyAddressesWithoutBalancerAttributes(addrs), - scopts: opts, - dopts: cc.dopts, - channelz: channelz.RegisterSubChannel(cc.channelz, ""), - resetBackoff: make(chan struct{}), - stateChan: make(chan struct{}), + state: connectivity.Idle, + cc: cc, + addrs: copyAddresses(addrs), + scopts: opts, + dopts: cc.dopts, + channelz: channelz.RegisterSubChannel(cc.channelz, ""), + resetBackoff: make(chan struct{}), + stateReadyChan: make(chan struct{}), } ac.ctx, ac.cancel = context.WithCancel(cc.ctx) // Start with our address set to the first address; this may be updated if @@ -918,28 +908,29 @@ func (ac *addrConn) connect() error { ac.mu.Unlock() return nil } - ac.mu.Unlock() - ac.resetTransport() + ac.resetTransportAndUnlock() return nil } -func equalAddresses(a, b []resolver.Address) bool { - if len(a) != len(b) { - return false - } - for i, v := range a { - if !v.Equal(b[i]) { - return false - } - } - return true +// equalAddressIgnoringBalAttributes returns true is a and b are considered equal. +// This is different from the Equal method on the resolver.Address type which +// considers all fields to determine equality. Here, we only consider fields +// that are meaningful to the subConn. +func equalAddressIgnoringBalAttributes(a, b *resolver.Address) bool { + return a.Addr == b.Addr && a.ServerName == b.ServerName && + a.Attributes.Equal(b.Attributes) && + a.Metadata == b.Metadata +} + +func equalAddressesIgnoringBalAttributes(a, b []resolver.Address) bool { + return slices.EqualFunc(a, b, func(a, b resolver.Address) bool { return equalAddressIgnoringBalAttributes(&a, &b) }) } // updateAddrs updates ac.addrs with the new addresses list and handles active // connections or connection attempts. func (ac *addrConn) updateAddrs(addrs []resolver.Address) { - addrs = copyAddressesWithoutBalancerAttributes(addrs) + addrs = copyAddresses(addrs) limit := len(addrs) if limit > 5 { limit = 5 @@ -947,7 +938,7 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { channelz.Infof(logger, ac.channelz, "addrConn: updateAddrs addrs (%d of %d): %v", limit, len(addrs), addrs[:limit]) ac.mu.Lock() - if equalAddresses(ac.addrs, addrs) { + if equalAddressesIgnoringBalAttributes(ac.addrs, addrs) { ac.mu.Unlock() return } @@ -966,7 +957,7 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { // Try to find the connected address. for _, a := range addrs { a.ServerName = ac.cc.getServerName(a) - if a.Equal(ac.curAddr) { + if equalAddressIgnoringBalAttributes(&a, &ac.curAddr) { // We are connected to a valid address, so do nothing but // update the addresses. ac.mu.Unlock() @@ -992,11 +983,9 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { ac.updateConnectivityState(connectivity.Idle, nil) } - ac.mu.Unlock() - // Since we were connecting/connected, we should start a new connection // attempt. - go ac.resetTransport() + go ac.resetTransportAndUnlock() } // getServerName determines the serverName to be used in the connection @@ -1190,8 +1179,8 @@ type addrConn struct { addrs []resolver.Address // All addresses that the resolver resolved to. // Use updateConnectivityState for updating addrConn's connectivity state. - state connectivity.State - stateChan chan struct{} // closed and recreated on every state change. + state connectivity.State + stateReadyChan chan struct{} // closed and recreated on every READY state change. backoffIdx int // Needs to be stateful for resetConnectBackoff. resetBackoff chan struct{} @@ -1204,9 +1193,6 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) if ac.state == s { return } - // When changing states, reset the state change channel. - close(ac.stateChan) - ac.stateChan = make(chan struct{}) ac.state = s ac.channelz.ChannelMetrics.State.Store(&s) if lastErr == nil { @@ -1214,7 +1200,7 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) } else { channelz.Infof(logger, ac.channelz, "Subchannel Connectivity change to %v, last error: %s", s, lastErr) } - ac.acbw.updateState(s, lastErr) + ac.acbw.updateState(s, ac.curAddr, lastErr) } // adjustParams updates parameters used to create transports upon @@ -1231,8 +1217,10 @@ func (ac *addrConn) adjustParams(r transport.GoAwayReason) { } } -func (ac *addrConn) resetTransport() { - ac.mu.Lock() +// resetTransportAndUnlock unconditionally connects the addrConn. +// +// ac.mu must be held by the caller, and this function will guarantee it is released. +func (ac *addrConn) resetTransportAndUnlock() { acCtx := ac.ctx if acCtx.Err() != nil { ac.mu.Unlock() @@ -1522,7 +1510,7 @@ func (ac *addrConn) getReadyTransport() transport.ClientTransport { func (ac *addrConn) getTransport(ctx context.Context) (transport.ClientTransport, error) { for ctx.Err() == nil { ac.mu.Lock() - t, state, sc := ac.transport, ac.state, ac.stateChan + t, state, sc := ac.transport, ac.state, ac.stateReadyChan ac.mu.Unlock() if state == connectivity.Ready { return t, nil @@ -1585,7 +1573,7 @@ func (ac *addrConn) tearDown(err error) { } else { // Hard close the transport when the channel is entering idle or is // being shutdown. In the case where the channel is being shutdown, - // closing of transports is also taken care of by cancelation of cc.ctx. + // closing of transports is also taken care of by cancellation of cc.ctx. // But in the case where the channel is entering idle, we need to // explicitly close the transports here. Instead of distinguishing // between these two cases, it is simpler to close the transport diff --git a/vendor/google.golang.org/grpc/codec.go b/vendor/google.golang.org/grpc/codec.go index 411e3dfd47..e840858b77 100644 --- a/vendor/google.golang.org/grpc/codec.go +++ b/vendor/google.golang.org/grpc/codec.go @@ -21,18 +21,73 @@ package grpc import ( "google.golang.org/grpc/encoding" _ "google.golang.org/grpc/encoding/proto" // to register the Codec for "proto" + "google.golang.org/grpc/mem" ) -// baseCodec contains the functionality of both Codec and encoding.Codec, but -// omits the name/string, which vary between the two and are not needed for -// anything besides the registry in the encoding package. +// baseCodec captures the new encoding.CodecV2 interface without the Name +// function, allowing it to be implemented by older Codec and encoding.Codec +// implementations. The omitted Name function is only needed for the register in +// the encoding package and is not part of the core functionality. type baseCodec interface { - Marshal(v any) ([]byte, error) - Unmarshal(data []byte, v any) error + Marshal(v any) (mem.BufferSlice, error) + Unmarshal(data mem.BufferSlice, v any) error +} + +// getCodec returns an encoding.CodecV2 for the codec of the given name (if +// registered). Initially checks the V2 registry with encoding.GetCodecV2 and +// returns the V2 codec if it is registered. Otherwise, it checks the V1 registry +// with encoding.GetCodec and if it is registered wraps it with newCodecV1Bridge +// to turn it into an encoding.CodecV2. Returns nil otherwise. +func getCodec(name string) encoding.CodecV2 { + if codecV1 := encoding.GetCodec(name); codecV1 != nil { + return newCodecV1Bridge(codecV1) + } + + return encoding.GetCodecV2(name) +} + +func newCodecV0Bridge(c Codec) baseCodec { + return codecV0Bridge{codec: c} +} + +func newCodecV1Bridge(c encoding.Codec) encoding.CodecV2 { + return codecV1Bridge{ + codecV0Bridge: codecV0Bridge{codec: c}, + name: c.Name(), + } +} + +var _ baseCodec = codecV0Bridge{} + +type codecV0Bridge struct { + codec interface { + Marshal(v any) ([]byte, error) + Unmarshal(data []byte, v any) error + } +} + +func (c codecV0Bridge) Marshal(v any) (mem.BufferSlice, error) { + data, err := c.codec.Marshal(v) + if err != nil { + return nil, err + } + return mem.BufferSlice{mem.NewBuffer(&data, nil)}, nil +} + +func (c codecV0Bridge) Unmarshal(data mem.BufferSlice, v any) (err error) { + return c.codec.Unmarshal(data.Materialize(), v) } -var _ baseCodec = Codec(nil) -var _ baseCodec = encoding.Codec(nil) +var _ encoding.CodecV2 = codecV1Bridge{} + +type codecV1Bridge struct { + codecV0Bridge + name string +} + +func (c codecV1Bridge) Name() string { + return c.name +} // Codec defines the interface gRPC uses to encode and decode messages. // Note that implementations of this interface must be thread safe; diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index f5453d48a5..27c1b9bb63 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/resolver" "google.golang.org/grpc/stats" ) @@ -60,7 +61,7 @@ func init() { internal.WithBinaryLogger = withBinaryLogger internal.JoinDialOptions = newJoinDialOption internal.DisableGlobalDialOptions = newDisableGlobalDialOptions - internal.WithRecvBufferPool = withRecvBufferPool + internal.WithBufferPool = withBufferPool } // dialOptions configure a Dial call. dialOptions are set by the DialOption @@ -92,7 +93,6 @@ type dialOptions struct { defaultServiceConfigRawJSON *string resolvers []resolver.Builder idleTimeout time.Duration - recvBufferPool SharedBufferPool defaultScheme string maxCallAttempts int } @@ -677,11 +677,11 @@ func defaultDialOptions() dialOptions { WriteBufferSize: defaultWriteBufSize, UseProxy: true, UserAgent: grpcUA, + BufferPool: mem.DefaultBufferPool(), }, bs: internalbackoff.DefaultExponential, healthCheckFunc: internal.HealthCheckFunc, idleTimeout: 30 * time.Minute, - recvBufferPool: nopBufferPool{}, defaultScheme: "dns", maxCallAttempts: defaultMaxCallAttempts, } @@ -758,25 +758,8 @@ func WithMaxCallAttempts(n int) DialOption { }) } -// WithRecvBufferPool returns a DialOption that configures the ClientConn -// to use the provided shared buffer pool for parsing incoming messages. Depending -// on the application's workload, this could result in reduced memory allocation. -// -// If you are unsure about how to implement a memory pool but want to utilize one, -// begin with grpc.NewSharedBufferPool. -// -// Note: The shared buffer pool feature will not be active if any of the following -// options are used: WithStatsHandler, EnableTracing, or binary logging. In such -// cases, the shared buffer pool will be ignored. -// -// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in -// v1.60.0 or later. -func WithRecvBufferPool(bufferPool SharedBufferPool) DialOption { - return withRecvBufferPool(bufferPool) -} - -func withRecvBufferPool(bufferPool SharedBufferPool) DialOption { +func withBufferPool(bufferPool mem.BufferPool) DialOption { return newFuncDialOption(func(o *dialOptions) { - o.recvBufferPool = bufferPool + o.copts.BufferPool = bufferPool }) } diff --git a/vendor/google.golang.org/grpc/doc.go b/vendor/google.golang.org/grpc/doc.go index 0022859ad7..e7b532b6f8 100644 --- a/vendor/google.golang.org/grpc/doc.go +++ b/vendor/google.golang.org/grpc/doc.go @@ -16,7 +16,7 @@ * */ -//go:generate ./regenerate.sh +//go:generate ./scripts/regenerate.sh /* Package grpc implements an RPC system called gRPC. diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 5ebf88d714..11d0ae142c 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -94,7 +94,7 @@ type Codec interface { Name() string } -var registeredCodecs = make(map[string]Codec) +var registeredCodecs = make(map[string]any) // RegisterCodec registers the provided Codec for use with all gRPC clients and // servers. @@ -126,5 +126,6 @@ func RegisterCodec(codec Codec) { // // The content-subtype is expected to be lowercase. func GetCodec(contentSubtype string) Codec { - return registeredCodecs[contentSubtype] + c, _ := registeredCodecs[contentSubtype].(Codec) + return c } diff --git a/vendor/google.golang.org/grpc/encoding/encoding_v2.go b/vendor/google.golang.org/grpc/encoding/encoding_v2.go new file mode 100644 index 0000000000..074c5e234a --- /dev/null +++ b/vendor/google.golang.org/grpc/encoding/encoding_v2.go @@ -0,0 +1,81 @@ +/* + * + * Copyright 2024 gRPC 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 encoding + +import ( + "strings" + + "google.golang.org/grpc/mem" +) + +// CodecV2 defines the interface gRPC uses to encode and decode messages. Note +// that implementations of this interface must be thread safe; a CodecV2's +// methods can be called from concurrent goroutines. +type CodecV2 interface { + // Marshal returns the wire format of v. The buffers in the returned + // [mem.BufferSlice] must have at least one reference each, which will be freed + // by gRPC when they are no longer needed. + Marshal(v any) (out mem.BufferSlice, err error) + // Unmarshal parses the wire format into v. Note that data will be freed as soon + // as this function returns. If the codec wishes to guarantee access to the data + // after this function, it must take its own reference that it frees when it is + // no longer needed. + Unmarshal(data mem.BufferSlice, v any) error + // Name returns the name of the Codec implementation. The returned string + // will be used as part of content type in transmission. The result must be + // static; the result cannot change between calls. + Name() string +} + +// RegisterCodecV2 registers the provided CodecV2 for use with all gRPC clients and +// servers. +// +// The CodecV2 will be stored and looked up by result of its Name() method, which +// should match the content-subtype of the encoding handled by the CodecV2. This +// is case-insensitive, and is stored and looked up as lowercase. If the +// result of calling Name() is an empty string, RegisterCodecV2 will panic. See +// Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// If both a Codec and CodecV2 are registered with the same name, the CodecV2 +// will be used. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Codecs are +// registered with the same name, the one registered last will take effect. +func RegisterCodecV2(codec CodecV2) { + if codec == nil { + panic("cannot register a nil CodecV2") + } + if codec.Name() == "" { + panic("cannot register CodecV2 with empty string result for Name()") + } + contentSubtype := strings.ToLower(codec.Name()) + registeredCodecs[contentSubtype] = codec +} + +// GetCodecV2 gets a registered CodecV2 by content-subtype, or nil if no CodecV2 is +// registered for the content-subtype. +// +// The content-subtype is expected to be lowercase. +func GetCodecV2(contentSubtype string) CodecV2 { + c, _ := registeredCodecs[contentSubtype].(CodecV2) + return c +} diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go index 66d5cdf03e..ceec319dd2 100644 --- a/vendor/google.golang.org/grpc/encoding/proto/proto.go +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -1,6 +1,6 @@ /* * - * Copyright 2018 gRPC authors. + * Copyright 2024 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import ( "fmt" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/mem" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/protoadapt" ) @@ -32,28 +33,51 @@ import ( const Name = "proto" func init() { - encoding.RegisterCodec(codec{}) + encoding.RegisterCodecV2(&codecV2{}) } -// codec is a Codec implementation with protobuf. It is the default codec for gRPC. -type codec struct{} +// codec is a CodecV2 implementation with protobuf. It is the default codec for +// gRPC. +type codecV2 struct{} -func (codec) Marshal(v any) ([]byte, error) { +func (c *codecV2) Marshal(v any) (data mem.BufferSlice, err error) { vv := messageV2Of(v) if vv == nil { - return nil, fmt.Errorf("failed to marshal, message is %T, want proto.Message", v) + return nil, fmt.Errorf("proto: failed to marshal, message is %T, want proto.Message", v) } - return proto.Marshal(vv) + size := proto.Size(vv) + if mem.IsBelowBufferPoolingThreshold(size) { + buf, err := proto.Marshal(vv) + if err != nil { + return nil, err + } + data = append(data, mem.SliceBuffer(buf)) + } else { + pool := mem.DefaultBufferPool() + buf := pool.Get(size) + if _, err := (proto.MarshalOptions{}).MarshalAppend((*buf)[:0], vv); err != nil { + pool.Put(buf) + return nil, err + } + data = append(data, mem.NewBuffer(buf, pool)) + } + + return data, nil } -func (codec) Unmarshal(data []byte, v any) error { +func (c *codecV2) Unmarshal(data mem.BufferSlice, v any) (err error) { vv := messageV2Of(v) if vv == nil { return fmt.Errorf("failed to unmarshal, message is %T, want proto.Message", v) } - return proto.Unmarshal(data, vv) + buf := data.MaterializeToBuffer(mem.DefaultBufferPool()) + defer buf.Free() + // TODO: Upgrade proto.Unmarshal to support mem.BufferSlice. Right now, it's not + // really possible without a major overhaul of the proto package, but the + // vtprotobuf library may be able to support this. + return proto.Unmarshal(buf.ReadOnlyData(), vv) } func messageV2Of(v any) proto.Message { @@ -67,6 +91,6 @@ func messageV2Of(v any) proto.Message { return nil } -func (codec) Name() string { +func (c *codecV2) Name() string { return Name } diff --git a/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go new file mode 100644 index 0000000000..1d827dd5d9 --- /dev/null +++ b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go @@ -0,0 +1,269 @@ +/* + * + * Copyright 2024 gRPC 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 stats + +import ( + "maps" + + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" +) + +func init() { + internal.SnapshotMetricRegistryForTesting = snapshotMetricsRegistryForTesting +} + +var logger = grpclog.Component("metrics-registry") + +// DefaultMetrics are the default metrics registered through global metrics +// registry. This is written to at initialization time only, and is read only +// after initialization. +var DefaultMetrics = NewMetrics() + +// MetricDescriptor is the data for a registered metric. +type MetricDescriptor struct { + // The name of this metric. This name must be unique across the whole binary + // (including any per call metrics). See + // https://github.com/grpc/proposal/blob/master/A79-non-per-call-metrics-architecture.md#metric-instrument-naming-conventions + // for metric naming conventions. + Name Metric + // The description of this metric. + Description string + // The unit (e.g. entries, seconds) of this metric. + Unit string + // The required label keys for this metric. These are intended to + // metrics emitted from a stats handler. + Labels []string + // The optional label keys for this metric. These are intended to attached + // to metrics emitted from a stats handler if configured. + OptionalLabels []string + // Whether this metric is on by default. + Default bool + // The type of metric. This is set by the metric registry, and not intended + // to be set by a component registering a metric. + Type MetricType + // Bounds are the bounds of this metric. This only applies to histogram + // metrics. If unset or set with length 0, stats handlers will fall back to + // default bounds. + Bounds []float64 +} + +// MetricType is the type of metric. +type MetricType int + +// Type of metric supported by this instrument registry. +const ( + MetricTypeIntCount MetricType = iota + MetricTypeFloatCount + MetricTypeIntHisto + MetricTypeFloatHisto + MetricTypeIntGauge +) + +// Int64CountHandle is a typed handle for a int count metric. This handle +// is passed at the recording point in order to know which metric to record +// on. +type Int64CountHandle MetricDescriptor + +// Descriptor returns the int64 count handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64CountHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 count value on the metrics recorder provided. +func (h *Int64CountHandle) Record(recorder MetricsRecorder, incr int64, labels ...string) { + recorder.RecordInt64Count(h, incr, labels...) +} + +// Float64CountHandle is a typed handle for a float count metric. This handle is +// passed at the recording point in order to know which metric to record on. +type Float64CountHandle MetricDescriptor + +// Descriptor returns the float64 count handle typecast to a pointer to a +// MetricDescriptor. +func (h *Float64CountHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the float64 count value on the metrics recorder provided. +func (h *Float64CountHandle) Record(recorder MetricsRecorder, incr float64, labels ...string) { + recorder.RecordFloat64Count(h, incr, labels...) +} + +// Int64HistoHandle is a typed handle for an int histogram metric. This handle +// is passed at the recording point in order to know which metric to record on. +type Int64HistoHandle MetricDescriptor + +// Descriptor returns the int64 histo handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64HistoHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 histo value on the metrics recorder provided. +func (h *Int64HistoHandle) Record(recorder MetricsRecorder, incr int64, labels ...string) { + recorder.RecordInt64Histo(h, incr, labels...) +} + +// Float64HistoHandle is a typed handle for a float histogram metric. This +// handle is passed at the recording point in order to know which metric to +// record on. +type Float64HistoHandle MetricDescriptor + +// Descriptor returns the float64 histo handle typecast to a pointer to a +// MetricDescriptor. +func (h *Float64HistoHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the float64 histo value on the metrics recorder provided. +func (h *Float64HistoHandle) Record(recorder MetricsRecorder, incr float64, labels ...string) { + recorder.RecordFloat64Histo(h, incr, labels...) +} + +// Int64GaugeHandle is a typed handle for an int gauge metric. This handle is +// passed at the recording point in order to know which metric to record on. +type Int64GaugeHandle MetricDescriptor + +// Descriptor returns the int64 gauge handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64GaugeHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 histo value on the metrics recorder provided. +func (h *Int64GaugeHandle) Record(recorder MetricsRecorder, incr int64, labels ...string) { + recorder.RecordInt64Gauge(h, incr, labels...) +} + +// registeredMetrics are the registered metric descriptor names. +var registeredMetrics = make(map[Metric]bool) + +// metricsRegistry contains all of the registered metrics. +// +// This is written to only at init time, and read only after that. +var metricsRegistry = make(map[Metric]*MetricDescriptor) + +// DescriptorForMetric returns the MetricDescriptor from the global registry. +// +// Returns nil if MetricDescriptor not present. +func DescriptorForMetric(metric Metric) *MetricDescriptor { + return metricsRegistry[metric] +} + +func registerMetric(name Metric, def bool) { + if registeredMetrics[name] { + logger.Fatalf("metric %v already registered", name) + } + registeredMetrics[name] = true + if def { + DefaultMetrics = DefaultMetrics.Add(name) + } +} + +// RegisterInt64Count registers the metric description onto the global registry. +// It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64Count(descriptor MetricDescriptor) *Int64CountHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntCount + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64CountHandle)(descPtr) +} + +// RegisterFloat64Count registers the metric description onto the global +// registry. It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterFloat64Count(descriptor MetricDescriptor) *Float64CountHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeFloatCount + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Float64CountHandle)(descPtr) +} + +// RegisterInt64Histo registers the metric description onto the global registry. +// It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64Histo(descriptor MetricDescriptor) *Int64HistoHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntHisto + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64HistoHandle)(descPtr) +} + +// RegisterFloat64Histo registers the metric description onto the global +// registry. It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterFloat64Histo(descriptor MetricDescriptor) *Float64HistoHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeFloatHisto + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Float64HistoHandle)(descPtr) +} + +// RegisterInt64Gauge registers the metric description onto the global registry. +// It returns a typed handle to use to recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64Gauge(descriptor MetricDescriptor) *Int64GaugeHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntGauge + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64GaugeHandle)(descPtr) +} + +// snapshotMetricsRegistryForTesting snapshots the global data of the metrics +// registry. Returns a cleanup function that sets the metrics registry to its +// original state. +func snapshotMetricsRegistryForTesting() func() { + oldDefaultMetrics := DefaultMetrics + oldRegisteredMetrics := registeredMetrics + oldMetricsRegistry := metricsRegistry + + registeredMetrics = make(map[Metric]bool) + metricsRegistry = make(map[Metric]*MetricDescriptor) + maps.Copy(registeredMetrics, registeredMetrics) + maps.Copy(metricsRegistry, metricsRegistry) + + return func() { + DefaultMetrics = oldDefaultMetrics + registeredMetrics = oldRegisteredMetrics + metricsRegistry = oldMetricsRegistry + } +} diff --git a/vendor/google.golang.org/grpc/experimental/stats/metrics.go b/vendor/google.golang.org/grpc/experimental/stats/metrics.go new file mode 100644 index 0000000000..3221f7a633 --- /dev/null +++ b/vendor/google.golang.org/grpc/experimental/stats/metrics.go @@ -0,0 +1,114 @@ +/* + * + * Copyright 2024 gRPC 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 stats contains experimental metrics/stats API's. +package stats + +import "maps" + +// MetricsRecorder records on metrics derived from metric registry. +type MetricsRecorder interface { + // RecordInt64Count records the measurement alongside labels on the int + // count associated with the provided handle. + RecordInt64Count(handle *Int64CountHandle, incr int64, labels ...string) + // RecordFloat64Count records the measurement alongside labels on the float + // count associated with the provided handle. + RecordFloat64Count(handle *Float64CountHandle, incr float64, labels ...string) + // RecordInt64Histo records the measurement alongside labels on the int + // histo associated with the provided handle. + RecordInt64Histo(handle *Int64HistoHandle, incr int64, labels ...string) + // RecordFloat64Histo records the measurement alongside labels on the float + // histo associated with the provided handle. + RecordFloat64Histo(handle *Float64HistoHandle, incr float64, labels ...string) + // RecordInt64Gauge records the measurement alongside labels on the int + // gauge associated with the provided handle. + RecordInt64Gauge(handle *Int64GaugeHandle, incr int64, labels ...string) +} + +// Metric is an identifier for a metric. +type Metric string + +// Metrics is a set of metrics to record. Once created, Metrics is immutable, +// however Add and Remove can make copies with specific metrics added or +// removed, respectively. +// +// Do not construct directly; use NewMetrics instead. +type Metrics struct { + // metrics are the set of metrics to initialize. + metrics map[Metric]bool +} + +// NewMetrics returns a Metrics containing Metrics. +func NewMetrics(metrics ...Metric) *Metrics { + newMetrics := make(map[Metric]bool) + for _, metric := range metrics { + newMetrics[metric] = true + } + return &Metrics{ + metrics: newMetrics, + } +} + +// Metrics returns the metrics set. The returned map is read-only and must not +// be modified. +func (m *Metrics) Metrics() map[Metric]bool { + return m.metrics +} + +// Add adds the metrics to the metrics set and returns a new copy with the +// additional metrics. +func (m *Metrics) Add(metrics ...Metric) *Metrics { + newMetrics := make(map[Metric]bool) + for metric := range m.metrics { + newMetrics[metric] = true + } + + for _, metric := range metrics { + newMetrics[metric] = true + } + return &Metrics{ + metrics: newMetrics, + } +} + +// Join joins the metrics passed in with the metrics set, and returns a new copy +// with the merged metrics. +func (m *Metrics) Join(metrics *Metrics) *Metrics { + newMetrics := make(map[Metric]bool) + maps.Copy(newMetrics, m.metrics) + maps.Copy(newMetrics, metrics.metrics) + return &Metrics{ + metrics: newMetrics, + } +} + +// Remove removes the metrics from the metrics set and returns a new copy with +// the metrics removed. +func (m *Metrics) Remove(metrics ...Metric) *Metrics { + newMetrics := make(map[Metric]bool) + for metric := range m.metrics { + newMetrics[metric] = true + } + + for _, metric := range metrics { + delete(newMetrics, metric) + } + return &Metrics{ + metrics: newMetrics, + } +} diff --git a/vendor/google.golang.org/grpc/grpclog/component.go b/vendor/google.golang.org/grpc/grpclog/component.go index ac73c9ced2..f1ae080dcb 100644 --- a/vendor/google.golang.org/grpc/grpclog/component.go +++ b/vendor/google.golang.org/grpc/grpclog/component.go @@ -20,8 +20,6 @@ package grpclog import ( "fmt" - - "google.golang.org/grpc/internal/grpclog" ) // componentData records the settings for a component. @@ -33,22 +31,22 @@ var cache = map[string]*componentData{} func (c *componentData) InfoDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.InfoDepth(depth+1, args...) + InfoDepth(depth+1, args...) } func (c *componentData) WarningDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.WarningDepth(depth+1, args...) + WarningDepth(depth+1, args...) } func (c *componentData) ErrorDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.ErrorDepth(depth+1, args...) + ErrorDepth(depth+1, args...) } func (c *componentData) FatalDepth(depth int, args ...any) { args = append([]any{"[" + string(c.name) + "]"}, args...) - grpclog.FatalDepth(depth+1, args...) + FatalDepth(depth+1, args...) } func (c *componentData) Info(args ...any) { diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index 16928c9cb9..db320105e6 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -18,18 +18,15 @@ // Package grpclog defines logging for grpc. // -// All logs in transport and grpclb packages only go to verbose level 2. -// All logs in other packages in grpc are logged in spite of the verbosity level. -// -// In the default logger, -// severity level can be set by environment variable GRPC_GO_LOG_SEVERITY_LEVEL, -// verbosity level can be set by GRPC_GO_LOG_VERBOSITY_LEVEL. -package grpclog // import "google.golang.org/grpc/grpclog" +// In the default logger, severity level can be set by environment variable +// GRPC_GO_LOG_SEVERITY_LEVEL, verbosity level can be set by +// GRPC_GO_LOG_VERBOSITY_LEVEL. +package grpclog import ( "os" - "google.golang.org/grpc/internal/grpclog" + "google.golang.org/grpc/grpclog/internal" ) func init() { @@ -38,58 +35,58 @@ func init() { // V reports whether verbosity level l is at least the requested verbose level. func V(l int) bool { - return grpclog.Logger.V(l) + return internal.LoggerV2Impl.V(l) } // Info logs to the INFO log. func Info(args ...any) { - grpclog.Logger.Info(args...) + internal.LoggerV2Impl.Info(args...) } // Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf. func Infof(format string, args ...any) { - grpclog.Logger.Infof(format, args...) + internal.LoggerV2Impl.Infof(format, args...) } // Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println. func Infoln(args ...any) { - grpclog.Logger.Infoln(args...) + internal.LoggerV2Impl.Infoln(args...) } // Warning logs to the WARNING log. func Warning(args ...any) { - grpclog.Logger.Warning(args...) + internal.LoggerV2Impl.Warning(args...) } // Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf. func Warningf(format string, args ...any) { - grpclog.Logger.Warningf(format, args...) + internal.LoggerV2Impl.Warningf(format, args...) } // Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println. func Warningln(args ...any) { - grpclog.Logger.Warningln(args...) + internal.LoggerV2Impl.Warningln(args...) } // Error logs to the ERROR log. func Error(args ...any) { - grpclog.Logger.Error(args...) + internal.LoggerV2Impl.Error(args...) } // Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf. func Errorf(format string, args ...any) { - grpclog.Logger.Errorf(format, args...) + internal.LoggerV2Impl.Errorf(format, args...) } // Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println. func Errorln(args ...any) { - grpclog.Logger.Errorln(args...) + internal.LoggerV2Impl.Errorln(args...) } // Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print. // It calls os.Exit() with exit code 1. func Fatal(args ...any) { - grpclog.Logger.Fatal(args...) + internal.LoggerV2Impl.Fatal(args...) // Make sure fatal logs will exit. os.Exit(1) } @@ -97,15 +94,15 @@ func Fatal(args ...any) { // Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf. // It calls os.Exit() with exit code 1. func Fatalf(format string, args ...any) { - grpclog.Logger.Fatalf(format, args...) + internal.LoggerV2Impl.Fatalf(format, args...) // Make sure fatal logs will exit. os.Exit(1) } // Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println. -// It calle os.Exit()) with exit code 1. +// It calls os.Exit() with exit code 1. func Fatalln(args ...any) { - grpclog.Logger.Fatalln(args...) + internal.LoggerV2Impl.Fatalln(args...) // Make sure fatal logs will exit. os.Exit(1) } @@ -114,19 +111,76 @@ func Fatalln(args ...any) { // // Deprecated: use Info. func Print(args ...any) { - grpclog.Logger.Info(args...) + internal.LoggerV2Impl.Info(args...) } // Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. // // Deprecated: use Infof. func Printf(format string, args ...any) { - grpclog.Logger.Infof(format, args...) + internal.LoggerV2Impl.Infof(format, args...) } // Println prints to the logger. Arguments are handled in the manner of fmt.Println. // // Deprecated: use Infoln. func Println(args ...any) { - grpclog.Logger.Infoln(args...) + internal.LoggerV2Impl.Infoln(args...) +} + +// InfoDepth logs to the INFO log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func InfoDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.InfoDepth(depth, args...) + } else { + internal.LoggerV2Impl.Infoln(args...) + } +} + +// WarningDepth logs to the WARNING log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func WarningDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.WarningDepth(depth, args...) + } else { + internal.LoggerV2Impl.Warningln(args...) + } +} + +// ErrorDepth logs to the ERROR log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func ErrorDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.ErrorDepth(depth, args...) + } else { + internal.LoggerV2Impl.Errorln(args...) + } +} + +// FatalDepth logs to the FATAL log at the specified depth. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func FatalDepth(depth int, args ...any) { + if internal.DepthLoggerV2Impl != nil { + internal.DepthLoggerV2Impl.FatalDepth(depth, args...) + } else { + internal.LoggerV2Impl.Fatalln(args...) + } + os.Exit(1) } diff --git a/vendor/google.golang.org/grpc/grpclog/internal/grpclog.go b/vendor/google.golang.org/grpc/grpclog/internal/grpclog.go new file mode 100644 index 0000000000..59c03bc14c --- /dev/null +++ b/vendor/google.golang.org/grpc/grpclog/internal/grpclog.go @@ -0,0 +1,26 @@ +/* + * + * Copyright 2024 gRPC 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 internal contains functionality internal to the grpclog package. +package internal + +// LoggerV2Impl is the logger used for the non-depth log functions. +var LoggerV2Impl LoggerV2 + +// DepthLoggerV2Impl is the logger used for the depth log functions. +var DepthLoggerV2Impl DepthLoggerV2 diff --git a/vendor/google.golang.org/grpc/grpclog/internal/logger.go b/vendor/google.golang.org/grpc/grpclog/internal/logger.go new file mode 100644 index 0000000000..0d9a824ce1 --- /dev/null +++ b/vendor/google.golang.org/grpc/grpclog/internal/logger.go @@ -0,0 +1,87 @@ +/* + * + * Copyright 2024 gRPC 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 internal + +// Logger mimics golang's standard Logger as an interface. +// +// Deprecated: use LoggerV2. +type Logger interface { + Fatal(args ...any) + Fatalf(format string, args ...any) + Fatalln(args ...any) + Print(args ...any) + Printf(format string, args ...any) + Println(args ...any) +} + +// LoggerWrapper wraps Logger into a LoggerV2. +type LoggerWrapper struct { + Logger +} + +// Info logs to INFO log. Arguments are handled in the manner of fmt.Print. +func (l *LoggerWrapper) Info(args ...any) { + l.Logger.Print(args...) +} + +// Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. +func (l *LoggerWrapper) Infoln(args ...any) { + l.Logger.Println(args...) +} + +// Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. +func (l *LoggerWrapper) Infof(format string, args ...any) { + l.Logger.Printf(format, args...) +} + +// Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. +func (l *LoggerWrapper) Warning(args ...any) { + l.Logger.Print(args...) +} + +// Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. +func (l *LoggerWrapper) Warningln(args ...any) { + l.Logger.Println(args...) +} + +// Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. +func (l *LoggerWrapper) Warningf(format string, args ...any) { + l.Logger.Printf(format, args...) +} + +// Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. +func (l *LoggerWrapper) Error(args ...any) { + l.Logger.Print(args...) +} + +// Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. +func (l *LoggerWrapper) Errorln(args ...any) { + l.Logger.Println(args...) +} + +// Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. +func (l *LoggerWrapper) Errorf(format string, args ...any) { + l.Logger.Printf(format, args...) +} + +// V reports whether verbosity level l is at least the requested verbose level. +func (*LoggerWrapper) V(l int) bool { + // Returns true for all verbose level. + return true +} diff --git a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/internal/loggerv2.go similarity index 52% rename from vendor/google.golang.org/grpc/internal/grpclog/grpclog.go rename to vendor/google.golang.org/grpc/grpclog/internal/loggerv2.go index bfc45102ab..07df71e98a 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/internal/loggerv2.go @@ -1,6 +1,6 @@ /* * - * Copyright 2020 gRPC authors. + * Copyright 2024 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,59 +16,17 @@ * */ -// Package grpclog (internal) defines depth logging for grpc. -package grpclog +package internal import ( + "encoding/json" + "fmt" + "io" + "log" "os" ) -// Logger is the logger used for the non-depth log functions. -var Logger LoggerV2 - -// DepthLogger is the logger used for the depth log functions. -var DepthLogger DepthLoggerV2 - -// InfoDepth logs to the INFO log at the specified depth. -func InfoDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.InfoDepth(depth, args...) - } else { - Logger.Infoln(args...) - } -} - -// WarningDepth logs to the WARNING log at the specified depth. -func WarningDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.WarningDepth(depth, args...) - } else { - Logger.Warningln(args...) - } -} - -// ErrorDepth logs to the ERROR log at the specified depth. -func ErrorDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.ErrorDepth(depth, args...) - } else { - Logger.Errorln(args...) - } -} - -// FatalDepth logs to the FATAL log at the specified depth. -func FatalDepth(depth int, args ...any) { - if DepthLogger != nil { - DepthLogger.FatalDepth(depth, args...) - } else { - Logger.Fatalln(args...) - } - os.Exit(1) -} - // LoggerV2 does underlying logging work for grpclog. -// This is a copy of the LoggerV2 defined in the external grpclog package. It -// is defined here to avoid a circular dependency. type LoggerV2 interface { // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. Info(args ...any) @@ -107,14 +65,13 @@ type LoggerV2 interface { // DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements // DepthLoggerV2, the below functions will be called with the appropriate stack // depth set for trivial functions the logger may ignore. -// This is a copy of the DepthLoggerV2 defined in the external grpclog package. -// It is defined here to avoid a circular dependency. // // # Experimental // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. type DepthLoggerV2 interface { + LoggerV2 // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println. InfoDepth(depth int, args ...any) // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println. @@ -124,3 +81,124 @@ type DepthLoggerV2 interface { // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println. FatalDepth(depth int, args ...any) } + +const ( + // infoLog indicates Info severity. + infoLog int = iota + // warningLog indicates Warning severity. + warningLog + // errorLog indicates Error severity. + errorLog + // fatalLog indicates Fatal severity. + fatalLog +) + +// severityName contains the string representation of each severity. +var severityName = []string{ + infoLog: "INFO", + warningLog: "WARNING", + errorLog: "ERROR", + fatalLog: "FATAL", +} + +// loggerT is the default logger used by grpclog. +type loggerT struct { + m []*log.Logger + v int + jsonFormat bool +} + +func (g *loggerT) output(severity int, s string) { + sevStr := severityName[severity] + if !g.jsonFormat { + g.m[severity].Output(2, fmt.Sprintf("%v: %v", sevStr, s)) + return + } + // TODO: we can also include the logging component, but that needs more + // (API) changes. + b, _ := json.Marshal(map[string]string{ + "severity": sevStr, + "message": s, + }) + g.m[severity].Output(2, string(b)) +} + +func (g *loggerT) Info(args ...any) { + g.output(infoLog, fmt.Sprint(args...)) +} + +func (g *loggerT) Infoln(args ...any) { + g.output(infoLog, fmt.Sprintln(args...)) +} + +func (g *loggerT) Infof(format string, args ...any) { + g.output(infoLog, fmt.Sprintf(format, args...)) +} + +func (g *loggerT) Warning(args ...any) { + g.output(warningLog, fmt.Sprint(args...)) +} + +func (g *loggerT) Warningln(args ...any) { + g.output(warningLog, fmt.Sprintln(args...)) +} + +func (g *loggerT) Warningf(format string, args ...any) { + g.output(warningLog, fmt.Sprintf(format, args...)) +} + +func (g *loggerT) Error(args ...any) { + g.output(errorLog, fmt.Sprint(args...)) +} + +func (g *loggerT) Errorln(args ...any) { + g.output(errorLog, fmt.Sprintln(args...)) +} + +func (g *loggerT) Errorf(format string, args ...any) { + g.output(errorLog, fmt.Sprintf(format, args...)) +} + +func (g *loggerT) Fatal(args ...any) { + g.output(fatalLog, fmt.Sprint(args...)) + os.Exit(1) +} + +func (g *loggerT) Fatalln(args ...any) { + g.output(fatalLog, fmt.Sprintln(args...)) + os.Exit(1) +} + +func (g *loggerT) Fatalf(format string, args ...any) { + g.output(fatalLog, fmt.Sprintf(format, args...)) + os.Exit(1) +} + +func (g *loggerT) V(l int) bool { + return l <= g.v +} + +// LoggerV2Config configures the LoggerV2 implementation. +type LoggerV2Config struct { + // Verbosity sets the verbosity level of the logger. + Verbosity int + // FormatJSON controls whether the logger should output logs in JSON format. + FormatJSON bool +} + +// NewLoggerV2 creates a new LoggerV2 instance with the provided configuration. +// The infoW, warningW, and errorW writers are used to write log messages of +// different severity levels. +func NewLoggerV2(infoW, warningW, errorW io.Writer, c LoggerV2Config) LoggerV2 { + var m []*log.Logger + flag := log.LstdFlags + if c.FormatJSON { + flag = 0 + } + m = append(m, log.New(infoW, "", flag)) + m = append(m, log.New(io.MultiWriter(infoW, warningW), "", flag)) + ew := io.MultiWriter(infoW, warningW, errorW) // ew will be used for error and fatal. + m = append(m, log.New(ew, "", flag)) + m = append(m, log.New(ew, "", flag)) + return &loggerT{m: m, v: c.Verbosity, jsonFormat: c.FormatJSON} +} diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go index b1674d8267..4b20358570 100644 --- a/vendor/google.golang.org/grpc/grpclog/logger.go +++ b/vendor/google.golang.org/grpc/grpclog/logger.go @@ -18,70 +18,17 @@ package grpclog -import "google.golang.org/grpc/internal/grpclog" +import "google.golang.org/grpc/grpclog/internal" // Logger mimics golang's standard Logger as an interface. // // Deprecated: use LoggerV2. -type Logger interface { - Fatal(args ...any) - Fatalf(format string, args ...any) - Fatalln(args ...any) - Print(args ...any) - Printf(format string, args ...any) - Println(args ...any) -} +type Logger internal.Logger // SetLogger sets the logger that is used in grpc. Call only from // init() functions. // // Deprecated: use SetLoggerV2. func SetLogger(l Logger) { - grpclog.Logger = &loggerWrapper{Logger: l} -} - -// loggerWrapper wraps Logger into a LoggerV2. -type loggerWrapper struct { - Logger -} - -func (g *loggerWrapper) Info(args ...any) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Infoln(args ...any) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Infof(format string, args ...any) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) Warning(args ...any) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Warningln(args ...any) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Warningf(format string, args ...any) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) Error(args ...any) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Errorln(args ...any) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Errorf(format string, args ...any) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) V(l int) bool { - // Returns true for all verbose level. - return true + internal.LoggerV2Impl = &internal.LoggerWrapper{Logger: l} } diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2.go b/vendor/google.golang.org/grpc/grpclog/loggerv2.go index ecfd36d713..892dc13d16 100644 --- a/vendor/google.golang.org/grpc/grpclog/loggerv2.go +++ b/vendor/google.golang.org/grpc/grpclog/loggerv2.go @@ -19,52 +19,16 @@ package grpclog import ( - "encoding/json" - "fmt" "io" - "log" "os" "strconv" "strings" - "google.golang.org/grpc/internal/grpclog" + "google.golang.org/grpc/grpclog/internal" ) // LoggerV2 does underlying logging work for grpclog. -type LoggerV2 interface { - // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. - Info(args ...any) - // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. - Infoln(args ...any) - // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. - Infof(format string, args ...any) - // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. - Warning(args ...any) - // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. - Warningln(args ...any) - // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. - Warningf(format string, args ...any) - // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. - Error(args ...any) - // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - Errorln(args ...any) - // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - Errorf(format string, args ...any) - // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatal(args ...any) - // Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalln(args ...any) - // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalf(format string, args ...any) - // V reports whether verbosity level l is at least the requested verbose level. - V(l int) bool -} +type LoggerV2 internal.LoggerV2 // SetLoggerV2 sets logger that is used in grpc to a V2 logger. // Not mutex-protected, should be called before any gRPC functions. @@ -72,34 +36,8 @@ func SetLoggerV2(l LoggerV2) { if _, ok := l.(*componentData); ok { panic("cannot use component logger as grpclog logger") } - grpclog.Logger = l - grpclog.DepthLogger, _ = l.(grpclog.DepthLoggerV2) -} - -const ( - // infoLog indicates Info severity. - infoLog int = iota - // warningLog indicates Warning severity. - warningLog - // errorLog indicates Error severity. - errorLog - // fatalLog indicates Fatal severity. - fatalLog -) - -// severityName contains the string representation of each severity. -var severityName = []string{ - infoLog: "INFO", - warningLog: "WARNING", - errorLog: "ERROR", - fatalLog: "FATAL", -} - -// loggerT is the default logger used by grpclog. -type loggerT struct { - m []*log.Logger - v int - jsonFormat bool + internal.LoggerV2Impl = l + internal.DepthLoggerV2Impl, _ = l.(internal.DepthLoggerV2) } // NewLoggerV2 creates a loggerV2 with the provided writers. @@ -108,32 +46,13 @@ type loggerT struct { // Warning logs will be written to warningW and infoW. // Info logs will be written to infoW. func NewLoggerV2(infoW, warningW, errorW io.Writer) LoggerV2 { - return newLoggerV2WithConfig(infoW, warningW, errorW, loggerV2Config{}) + return internal.NewLoggerV2(infoW, warningW, errorW, internal.LoggerV2Config{}) } // NewLoggerV2WithVerbosity creates a loggerV2 with the provided writers and // verbosity level. func NewLoggerV2WithVerbosity(infoW, warningW, errorW io.Writer, v int) LoggerV2 { - return newLoggerV2WithConfig(infoW, warningW, errorW, loggerV2Config{verbose: v}) -} - -type loggerV2Config struct { - verbose int - jsonFormat bool -} - -func newLoggerV2WithConfig(infoW, warningW, errorW io.Writer, c loggerV2Config) LoggerV2 { - var m []*log.Logger - flag := log.LstdFlags - if c.jsonFormat { - flag = 0 - } - m = append(m, log.New(infoW, "", flag)) - m = append(m, log.New(io.MultiWriter(infoW, warningW), "", flag)) - ew := io.MultiWriter(infoW, warningW, errorW) // ew will be used for error and fatal. - m = append(m, log.New(ew, "", flag)) - m = append(m, log.New(ew, "", flag)) - return &loggerT{m: m, v: c.verbose, jsonFormat: c.jsonFormat} + return internal.NewLoggerV2(infoW, warningW, errorW, internal.LoggerV2Config{Verbosity: v}) } // newLoggerV2 creates a loggerV2 to be used as default logger. @@ -161,80 +80,10 @@ func newLoggerV2() LoggerV2 { jsonFormat := strings.EqualFold(os.Getenv("GRPC_GO_LOG_FORMATTER"), "json") - return newLoggerV2WithConfig(infoW, warningW, errorW, loggerV2Config{ - verbose: v, - jsonFormat: jsonFormat, - }) -} - -func (g *loggerT) output(severity int, s string) { - sevStr := severityName[severity] - if !g.jsonFormat { - g.m[severity].Output(2, fmt.Sprintf("%v: %v", sevStr, s)) - return - } - // TODO: we can also include the logging component, but that needs more - // (API) changes. - b, _ := json.Marshal(map[string]string{ - "severity": sevStr, - "message": s, + return internal.NewLoggerV2(infoW, warningW, errorW, internal.LoggerV2Config{ + Verbosity: v, + FormatJSON: jsonFormat, }) - g.m[severity].Output(2, string(b)) -} - -func (g *loggerT) Info(args ...any) { - g.output(infoLog, fmt.Sprint(args...)) -} - -func (g *loggerT) Infoln(args ...any) { - g.output(infoLog, fmt.Sprintln(args...)) -} - -func (g *loggerT) Infof(format string, args ...any) { - g.output(infoLog, fmt.Sprintf(format, args...)) -} - -func (g *loggerT) Warning(args ...any) { - g.output(warningLog, fmt.Sprint(args...)) -} - -func (g *loggerT) Warningln(args ...any) { - g.output(warningLog, fmt.Sprintln(args...)) -} - -func (g *loggerT) Warningf(format string, args ...any) { - g.output(warningLog, fmt.Sprintf(format, args...)) -} - -func (g *loggerT) Error(args ...any) { - g.output(errorLog, fmt.Sprint(args...)) -} - -func (g *loggerT) Errorln(args ...any) { - g.output(errorLog, fmt.Sprintln(args...)) -} - -func (g *loggerT) Errorf(format string, args ...any) { - g.output(errorLog, fmt.Sprintf(format, args...)) -} - -func (g *loggerT) Fatal(args ...any) { - g.output(fatalLog, fmt.Sprint(args...)) - os.Exit(1) -} - -func (g *loggerT) Fatalln(args ...any) { - g.output(fatalLog, fmt.Sprintln(args...)) - os.Exit(1) -} - -func (g *loggerT) Fatalf(format string, args ...any) { - g.output(fatalLog, fmt.Sprintf(format, args...)) - os.Exit(1) -} - -func (g *loggerT) V(l int) bool { - return l <= g.v } // DepthLoggerV2 logs at a specified call frame. If a LoggerV2 also implements @@ -245,14 +94,4 @@ func (g *loggerT) V(l int) bool { // // Notice: This type is EXPERIMENTAL and may be changed or removed in a // later release. -type DepthLoggerV2 interface { - LoggerV2 - // InfoDepth logs to INFO log at the specified depth. Arguments are handled in the manner of fmt.Println. - InfoDepth(depth int, args ...any) - // WarningDepth logs to WARNING log at the specified depth. Arguments are handled in the manner of fmt.Println. - WarningDepth(depth int, args ...any) - // ErrorDepth logs to ERROR log at the specified depth. Arguments are handled in the manner of fmt.Println. - ErrorDepth(depth int, args ...any) - // FatalDepth logs to FATAL log at the specified depth. Arguments are handled in the manner of fmt.Println. - FatalDepth(depth int, args ...any) -} +type DepthLoggerV2 internal.DepthLoggerV2 diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index 38b8835073..e65cf0ea15 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc v5.27.1 // source: grpc/health/v1/health.proto package grpc_health_v1 diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go index 51b736ba06..f96b8ab492 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go @@ -17,8 +17,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.1 // source: grpc/health/v1/health.proto package grpc_health_v1 @@ -32,8 +32,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Health_Check_FullMethodName = "/grpc.health.v1.Health/Check" @@ -73,7 +73,7 @@ type HealthClient interface { // should assume this method is not supported and should not retry the // call. If the call terminates with any other status (including OK), // clients should retry the call with appropriate exponential backoff. - Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) + Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[HealthCheckResponse], error) } type healthClient struct { @@ -94,13 +94,13 @@ func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts . return out, nil } -func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) { +func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[HealthCheckResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &healthWatchClient{ClientStream: stream} + x := &grpc.GenericClientStream[HealthCheckRequest, HealthCheckResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -110,26 +110,12 @@ func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts . return x, nil } -type Health_WatchClient interface { - Recv() (*HealthCheckResponse, error) - grpc.ClientStream -} - -type healthWatchClient struct { - grpc.ClientStream -} - -func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) { - m := new(HealthCheckResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Health_WatchClient = grpc.ServerStreamingClient[HealthCheckResponse] // HealthServer is the server API for Health service. // All implementations should embed UnimplementedHealthServer -// for forward compatibility +// for forward compatibility. // // Health is gRPC's mechanism for checking whether a server is able to handle // RPCs. Its semantics are documented in @@ -160,19 +146,23 @@ type HealthServer interface { // should assume this method is not supported and should not retry the // call. If the call terminates with any other status (including OK), // clients should retry the call with appropriate exponential backoff. - Watch(*HealthCheckRequest, Health_WatchServer) error + Watch(*HealthCheckRequest, grpc.ServerStreamingServer[HealthCheckResponse]) error } -// UnimplementedHealthServer should be embedded to have forward compatible implementations. -type UnimplementedHealthServer struct { -} +// UnimplementedHealthServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedHealthServer struct{} func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") } -func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error { +func (UnimplementedHealthServer) Watch(*HealthCheckRequest, grpc.ServerStreamingServer[HealthCheckResponse]) error { return status.Errorf(codes.Unimplemented, "method Watch not implemented") } +func (UnimplementedHealthServer) testEmbeddedByValue() {} // UnsafeHealthServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to HealthServer will @@ -182,6 +172,13 @@ type UnsafeHealthServer interface { } func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) { + // If the following call panics, it indicates UnimplementedHealthServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Health_ServiceDesc, srv) } @@ -208,21 +205,11 @@ func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(HealthServer).Watch(m, &healthWatchServer{ServerStream: stream}) -} - -type Health_WatchServer interface { - Send(*HealthCheckResponse) error - grpc.ServerStream + return srv.(HealthServer).Watch(m, &grpc.GenericServerStream[HealthCheckRequest, HealthCheckResponse]{ServerStream: stream}) } -type healthWatchServer struct { - grpc.ServerStream -} - -func (x *healthWatchServer) Send(m *HealthCheckResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Health_WatchServer = grpc.ServerStreamingServer[HealthCheckResponse] // Health_ServiceDesc is the grpc.ServiceDesc for Health service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go index dfe18b0892..bb531225d5 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go +++ b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go @@ -46,7 +46,7 @@ type entry interface { // channelMap is the storage data structure for channelz. // -// Methods of channelMap can be divided in two two categories with respect to +// Methods of channelMap can be divided into two categories with respect to // locking. // // 1. Methods acquire the global lock. diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index d906487139..00abc7c2be 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -46,6 +46,10 @@ var ( // by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true" // or "false". EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", false) + // XDSFallbackSupport is the env variable that controls whether support for + // xDS fallback is turned on. If this is unset or is false, only the first + // xDS server in the list of server configs will be used. + XDSFallbackSupport = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK", false) ) func boolFromEnv(envVar string, def bool) bool { diff --git a/vendor/google.golang.org/grpc/internal/experimental.go b/vendor/google.golang.org/grpc/internal/experimental.go index 7f7044e173..7617be2158 100644 --- a/vendor/google.golang.org/grpc/internal/experimental.go +++ b/vendor/google.golang.org/grpc/internal/experimental.go @@ -18,11 +18,11 @@ package internal var ( - // WithRecvBufferPool is implemented by the grpc package and returns a dial + // WithBufferPool is implemented by the grpc package and returns a dial // option to configure a shared buffer pool for a grpc.ClientConn. - WithRecvBufferPool any // func (grpc.SharedBufferPool) grpc.DialOption + WithBufferPool any // func (grpc.SharedBufferPool) grpc.DialOption - // RecvBufferPool is implemented by the grpc package and returns a server + // BufferPool is implemented by the grpc package and returns a server // option to configure a shared buffer pool for a grpc.Server. - RecvBufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption + BufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption ) diff --git a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go b/vendor/google.golang.org/grpc/internal/grpclog/prefix_logger.go similarity index 63% rename from vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go rename to vendor/google.golang.org/grpc/internal/grpclog/prefix_logger.go index faa998de76..092ad187a2 100644 --- a/vendor/google.golang.org/grpc/internal/grpclog/prefixLogger.go +++ b/vendor/google.golang.org/grpc/internal/grpclog/prefix_logger.go @@ -16,17 +16,21 @@ * */ +// Package grpclog provides logging functionality for internal gRPC packages, +// outside of the functionality provided by the external `grpclog` package. package grpclog import ( "fmt" + + "google.golang.org/grpc/grpclog" ) // PrefixLogger does logging with a prefix. // // Logging method on a nil logs without any prefix. type PrefixLogger struct { - logger DepthLoggerV2 + logger grpclog.DepthLoggerV2 prefix string } @@ -38,7 +42,7 @@ func (pl *PrefixLogger) Infof(format string, args ...any) { pl.logger.InfoDepth(1, fmt.Sprintf(format, args...)) return } - InfoDepth(1, fmt.Sprintf(format, args...)) + grpclog.InfoDepth(1, fmt.Sprintf(format, args...)) } // Warningf does warning logging. @@ -48,7 +52,7 @@ func (pl *PrefixLogger) Warningf(format string, args ...any) { pl.logger.WarningDepth(1, fmt.Sprintf(format, args...)) return } - WarningDepth(1, fmt.Sprintf(format, args...)) + grpclog.WarningDepth(1, fmt.Sprintf(format, args...)) } // Errorf does error logging. @@ -58,36 +62,18 @@ func (pl *PrefixLogger) Errorf(format string, args ...any) { pl.logger.ErrorDepth(1, fmt.Sprintf(format, args...)) return } - ErrorDepth(1, fmt.Sprintf(format, args...)) -} - -// Debugf does info logging at verbose level 2. -func (pl *PrefixLogger) Debugf(format string, args ...any) { - // TODO(6044): Refactor interfaces LoggerV2 and DepthLogger, and maybe - // rewrite PrefixLogger a little to ensure that we don't use the global - // `Logger` here, and instead use the `logger` field. - if !Logger.V(2) { - return - } - if pl != nil { - // Handle nil, so the tests can pass in a nil logger. - format = pl.prefix + format - pl.logger.InfoDepth(1, fmt.Sprintf(format, args...)) - return - } - InfoDepth(1, fmt.Sprintf(format, args...)) - + grpclog.ErrorDepth(1, fmt.Sprintf(format, args...)) } // V reports whether verbosity level l is at least the requested verbose level. func (pl *PrefixLogger) V(l int) bool { - // TODO(6044): Refactor interfaces LoggerV2 and DepthLogger, and maybe - // rewrite PrefixLogger a little to ensure that we don't use the global - // `Logger` here, and instead use the `logger` field. - return Logger.V(l) + if pl != nil { + return pl.logger.V(l) + } + return true } // NewPrefixLogger creates a prefix logger with the given prefix. -func NewPrefixLogger(logger DepthLoggerV2, prefix string) *PrefixLogger { +func NewPrefixLogger(logger grpclog.DepthLoggerV2, prefix string) *PrefixLogger { return &PrefixLogger{logger: logger, prefix: prefix} } diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go index f7f40a16ac..19b9d63927 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go @@ -53,16 +53,28 @@ func NewCallbackSerializer(ctx context.Context) *CallbackSerializer { return cs } -// Schedule adds a callback to be scheduled after existing callbacks are run. +// TrySchedule tries to schedules the provided callback function f to be +// executed in the order it was added. This is a best-effort operation. If the +// context passed to NewCallbackSerializer was canceled before this method is +// called, the callback will not be scheduled. // // Callbacks are expected to honor the context when performing any blocking // operations, and should return early when the context is canceled. +func (cs *CallbackSerializer) TrySchedule(f func(ctx context.Context)) { + cs.callbacks.Put(f) +} + +// ScheduleOr schedules the provided callback function f to be executed in the +// order it was added. If the context passed to NewCallbackSerializer has been +// canceled before this method is called, the onFailure callback will be +// executed inline instead. // -// Return value indicates if the callback was successfully added to the list of -// callbacks to be executed by the serializer. It is not possible to add -// callbacks once the context passed to NewCallbackSerializer is cancelled. -func (cs *CallbackSerializer) Schedule(f func(ctx context.Context)) bool { - return cs.callbacks.Put(f) == nil +// Callbacks are expected to honor the context when performing any blocking +// operations, and should return early when the context is canceled. +func (cs *CallbackSerializer) ScheduleOr(f func(ctx context.Context), onFailure func()) { + if cs.callbacks.Put(f) != nil { + onFailure() + } } func (cs *CallbackSerializer) run(ctx context.Context) { diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go b/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go index aef8cec1ab..6d8c2f518d 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/pubsub.go @@ -77,7 +77,7 @@ func (ps *PubSub) Subscribe(sub Subscriber) (cancel func()) { if ps.msg != nil { msg := ps.msg - ps.cs.Schedule(func(context.Context) { + ps.cs.TrySchedule(func(context.Context) { ps.mu.Lock() defer ps.mu.Unlock() if !ps.subscribers[sub] { @@ -103,7 +103,7 @@ func (ps *PubSub) Publish(msg any) { ps.msg = msg for sub := range ps.subscribers { s := sub - ps.cs.Schedule(func(context.Context) { + ps.cs.TrySchedule(func(context.Context) { ps.mu.Lock() defer ps.mu.Unlock() if !ps.subscribers[s] { diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 5d66539869..73fa407b6c 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -208,6 +208,26 @@ var ( // ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n // is the number of elements. swap swaps the elements with indexes i and j. ShuffleAddressListForTesting any // func(n int, swap func(i, j int)) + + // ConnectedAddress returns the connected address for a SubConnState. The + // address is only valid if the state is READY. + ConnectedAddress any // func (scs SubConnState) resolver.Address + + // SetConnectedAddress sets the connected address for a SubConnState. + SetConnectedAddress any // func(scs *SubConnState, addr resolver.Address) + + // SnapshotMetricRegistryForTesting snapshots the global data of the metric + // registry. Returns a cleanup function that sets the metric registry to its + // original state. Only called in testing functions. + SnapshotMetricRegistryForTesting func() func() + + // SetDefaultBufferPoolForTesting updates the default buffer pool, for + // testing purposes. + SetDefaultBufferPoolForTesting any // func(mem.BufferPool) + + // SetBufferPoolingThresholdForTesting updates the buffer pooling threshold, for + // testing purposes. + SetBufferPoolingThresholdForTesting any // func(int) ) // HealthChecker defines the signature of the client-side LB channel health diff --git a/vendor/google.golang.org/grpc/internal/stats/labels.go b/vendor/google.golang.org/grpc/internal/stats/labels.go new file mode 100644 index 0000000000..fd33af51ae --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/stats/labels.go @@ -0,0 +1,42 @@ +/* + * + * Copyright 2024 gRPC 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 stats provides internal stats related functionality. +package stats + +import "context" + +// Labels are the labels for metrics. +type Labels struct { + // TelemetryLabels are the telemetry labels to record. + TelemetryLabels map[string]string +} + +type labelsKey struct{} + +// GetLabels returns the Labels stored in the context, or nil if there is one. +func GetLabels(ctx context.Context) *Labels { + labels, _ := ctx.Value(labelsKey{}).(*Labels) + return labels +} + +// SetLabels sets the Labels in the context. +func SetLabels(ctx context.Context, labels *Labels) context.Context { + // could also append + return context.WithValue(ctx, labelsKey{}, labels) +} diff --git a/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go b/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go new file mode 100644 index 0000000000..be110d41f9 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go @@ -0,0 +1,95 @@ +/* + * Copyright 2024 gRPC 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 stats + +import ( + "fmt" + + estats "google.golang.org/grpc/experimental/stats" + "google.golang.org/grpc/stats" +) + +// MetricsRecorderList forwards Record calls to all of its metricsRecorders. +// +// It eats any record calls where the label values provided do not match the +// number of label keys. +type MetricsRecorderList struct { + // metricsRecorders are the metrics recorders this list will forward to. + metricsRecorders []estats.MetricsRecorder +} + +// NewMetricsRecorderList creates a new metric recorder list with all the stats +// handlers provided which implement the MetricsRecorder interface. +// If no stats handlers provided implement the MetricsRecorder interface, +// the MetricsRecorder list returned is a no-op. +func NewMetricsRecorderList(shs []stats.Handler) *MetricsRecorderList { + var mrs []estats.MetricsRecorder + for _, sh := range shs { + if mr, ok := sh.(estats.MetricsRecorder); ok { + mrs = append(mrs, mr) + } + } + return &MetricsRecorderList{ + metricsRecorders: mrs, + } +} + +func verifyLabels(desc *estats.MetricDescriptor, labelsRecv ...string) { + if got, want := len(labelsRecv), len(desc.Labels)+len(desc.OptionalLabels); got != want { + panic(fmt.Sprintf("Received %d labels in call to record metric %q, but expected %d.", got, desc.Name, want)) + } +} + +func (l *MetricsRecorderList) RecordInt64Count(handle *estats.Int64CountHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64Count(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordFloat64Count(handle *estats.Float64CountHandle, incr float64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordFloat64Count(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordInt64Histo(handle *estats.Int64HistoHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64Histo(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordFloat64Histo(handle *estats.Float64HistoHandle, incr float64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordFloat64Histo(handle, incr, labels...) + } +} + +func (l *MetricsRecorderList) RecordInt64Gauge(handle *estats.Int64GaugeHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64Gauge(handle, incr, labels...) + } +} diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go index 078137b7fd..7e7aaa5463 100644 --- a/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_unix.go @@ -44,7 +44,7 @@ func NetDialerWithTCPKeepalive() *net.Dialer { // combination of unconditionally enabling TCP keepalives here, and // disabling the overriding of TCP keepalive parameters by setting the // KeepAlive field to a negative value above, results in OS defaults for - // the TCP keealive interval and time parameters. + // the TCP keepalive interval and time parameters. Control: func(_, _ string, c syscall.RawConn) error { return c.Control(func(fd uintptr) { unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_KEEPALIVE, 1) diff --git a/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go index fd7d43a890..d5c1085eea 100644 --- a/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go +++ b/vendor/google.golang.org/grpc/internal/tcp_keepalive_windows.go @@ -44,7 +44,7 @@ func NetDialerWithTCPKeepalive() *net.Dialer { // combination of unconditionally enabling TCP keepalives here, and // disabling the overriding of TCP keepalive parameters by setting the // KeepAlive field to a negative value above, results in OS defaults for - // the TCP keealive interval and time parameters. + // the TCP keepalive interval and time parameters. Control: func(_, _ string, c syscall.RawConn) error { return c.Control(func(fd uintptr) { windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_KEEPALIVE, 1) diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index 3deadfb4a2..ea0633bbda 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -32,6 +32,7 @@ import ( "golang.org/x/net/http2/hpack" "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcutil" + "google.golang.org/grpc/mem" "google.golang.org/grpc/status" ) @@ -148,9 +149,9 @@ type dataFrame struct { streamID uint32 endStream bool h []byte - d []byte + reader mem.Reader // onEachWrite is called every time - // a part of d is written out. + // a part of data is written out. onEachWrite func() } @@ -289,18 +290,22 @@ func (l *outStreamList) dequeue() *outStream { } // controlBuffer is a way to pass information to loopy. -// Information is passed as specific struct types called control frames. -// A control frame not only represents data, messages or headers to be sent out -// but can also be used to instruct loopy to update its internal state. -// It shouldn't be confused with an HTTP2 frame, although some of the control frames -// like dataFrame and headerFrame do go out on wire as HTTP2 frames. +// +// Information is passed as specific struct types called control frames. A +// control frame not only represents data, messages or headers to be sent out +// but can also be used to instruct loopy to update its internal state. It +// shouldn't be confused with an HTTP2 frame, although some of the control +// frames like dataFrame and headerFrame do go out on wire as HTTP2 frames. type controlBuffer struct { - ch chan struct{} - done <-chan struct{} + wakeupCh chan struct{} // Unblocks readers waiting for something to read. + done <-chan struct{} // Closed when the transport is done. + + // Mutex guards all the fields below, except trfChan which can be read + // atomically without holding mu. mu sync.Mutex - consumerWaiting bool - list *itemList - err error + consumerWaiting bool // True when readers are blocked waiting for new data. + closed bool // True when the controlbuf is finished. + list *itemList // List of queued control frames. // transportResponseFrames counts the number of queued items that represent // the response of an action initiated by the peer. trfChan is created @@ -308,47 +313,59 @@ type controlBuffer struct { // closed and nilled when transportResponseFrames drops below the // threshold. Both fields are protected by mu. transportResponseFrames int - trfChan atomic.Value // chan struct{} + trfChan atomic.Pointer[chan struct{}] } func newControlBuffer(done <-chan struct{}) *controlBuffer { return &controlBuffer{ - ch: make(chan struct{}, 1), - list: &itemList{}, - done: done, + wakeupCh: make(chan struct{}, 1), + list: &itemList{}, + done: done, } } -// throttle blocks if there are too many incomingSettings/cleanupStreams in the -// controlbuf. +// throttle blocks if there are too many frames in the control buf that +// represent the response of an action initiated by the peer, like +// incomingSettings cleanupStreams etc. func (c *controlBuffer) throttle() { - ch, _ := c.trfChan.Load().(chan struct{}) - if ch != nil { + if ch := c.trfChan.Load(); ch != nil { select { - case <-ch: + case <-(*ch): case <-c.done: } } } +// put adds an item to the controlbuf. func (c *controlBuffer) put(it cbItem) error { _, err := c.executeAndPut(nil, it) return err } +// executeAndPut runs f, and if the return value is true, adds the given item to +// the controlbuf. The item could be nil, in which case, this method simply +// executes f and does not add the item to the controlbuf. +// +// The first return value indicates whether the item was successfully added to +// the control buffer. A non-nil error, specifically ErrConnClosing, is returned +// if the control buffer is already closed. func (c *controlBuffer) executeAndPut(f func() bool, it cbItem) (bool, error) { - var wakeUp bool c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return false, c.err + defer c.mu.Unlock() + + if c.closed { + return false, ErrConnClosing } if f != nil { if !f() { // f wasn't successful - c.mu.Unlock() return false, nil } } + if it == nil { + return true, nil + } + + var wakeUp bool if c.consumerWaiting { wakeUp = true c.consumerWaiting = false @@ -359,98 +376,102 @@ func (c *controlBuffer) executeAndPut(f func() bool, it cbItem) (bool, error) { if c.transportResponseFrames == maxQueuedTransportResponseFrames { // We are adding the frame that puts us over the threshold; create // a throttling channel. - c.trfChan.Store(make(chan struct{})) + ch := make(chan struct{}) + c.trfChan.Store(&ch) } } - c.mu.Unlock() if wakeUp { select { - case c.ch <- struct{}{}: + case c.wakeupCh <- struct{}{}: default: } } return true, nil } -// Note argument f should never be nil. -func (c *controlBuffer) execute(f func(it any) bool, it any) (bool, error) { - c.mu.Lock() - if c.err != nil { - c.mu.Unlock() - return false, c.err - } - if !f(it) { // f wasn't successful - c.mu.Unlock() - return false, nil - } - c.mu.Unlock() - return true, nil -} - +// get returns the next control frame from the control buffer. If block is true +// **and** there are no control frames in the control buffer, the call blocks +// until one of the conditions is met: there is a frame to return or the +// transport is closed. func (c *controlBuffer) get(block bool) (any, error) { for { c.mu.Lock() - if c.err != nil { + frame, err := c.getOnceLocked() + if frame != nil || err != nil || !block { + // If we read a frame or an error, we can return to the caller. The + // call to getOnceLocked() returns a nil frame and a nil error if + // there is nothing to read, and in that case, if the caller asked + // us not to block, we can return now as well. c.mu.Unlock() - return nil, c.err - } - if !c.list.isEmpty() { - h := c.list.dequeue().(cbItem) - if h.isTransportResponseFrame() { - if c.transportResponseFrames == maxQueuedTransportResponseFrames { - // We are removing the frame that put us over the - // threshold; close and clear the throttling channel. - ch := c.trfChan.Load().(chan struct{}) - close(ch) - c.trfChan.Store((chan struct{})(nil)) - } - c.transportResponseFrames-- - } - c.mu.Unlock() - return h, nil - } - if !block { - c.mu.Unlock() - return nil, nil + return frame, err } c.consumerWaiting = true c.mu.Unlock() + + // Release the lock above and wait to be woken up. select { - case <-c.ch: + case <-c.wakeupCh: case <-c.done: return nil, errors.New("transport closed by client") } } } +// Callers must not use this method, but should instead use get(). +// +// Caller must hold c.mu. +func (c *controlBuffer) getOnceLocked() (any, error) { + if c.closed { + return false, ErrConnClosing + } + if c.list.isEmpty() { + return nil, nil + } + h := c.list.dequeue().(cbItem) + if h.isTransportResponseFrame() { + if c.transportResponseFrames == maxQueuedTransportResponseFrames { + // We are removing the frame that put us over the + // threshold; close and clear the throttling channel. + ch := c.trfChan.Swap(nil) + close(*ch) + } + c.transportResponseFrames-- + } + return h, nil +} + +// finish closes the control buffer, cleaning up any streams that have queued +// header frames. Once this method returns, no more frames can be added to the +// control buffer, and attempts to do so will return ErrConnClosing. func (c *controlBuffer) finish() { c.mu.Lock() - if c.err != nil { - c.mu.Unlock() + defer c.mu.Unlock() + + if c.closed { return } - c.err = ErrConnClosing + c.closed = true // There may be headers for streams in the control buffer. // These streams need to be cleaned out since the transport // is still not aware of these yet. for head := c.list.dequeueAll(); head != nil; head = head.next { - hdr, ok := head.it.(*headerFrame) - if !ok { - continue - } - if hdr.onOrphaned != nil { // It will be nil on the server-side. - hdr.onOrphaned(ErrConnClosing) + switch v := head.it.(type) { + case *headerFrame: + if v.onOrphaned != nil { // It will be nil on the server-side. + v.onOrphaned(ErrConnClosing) + } + case *dataFrame: + _ = v.reader.Close() } } + // In case throttle() is currently in flight, it needs to be unblocked. // Otherwise, the transport may not close, since the transport is closed by // the reader encountering the connection error. - ch, _ := c.trfChan.Load().(chan struct{}) + ch := c.trfChan.Swap(nil) if ch != nil { - close(ch) + close(*ch) } - c.trfChan.Store((chan struct{})(nil)) - c.mu.Unlock() } type side int @@ -466,7 +487,7 @@ const ( // stream maintains a queue of data frames; as loopy receives data frames // it gets added to the queue of the relevant stream. // Loopy goes over this list of active streams by processing one node every iteration, -// thereby closely resemebling to a round-robin scheduling over all streams. While +// thereby closely resembling a round-robin scheduling over all streams. While // processing a stream, loopy writes out data bytes from this stream capped by the min // of http2MaxFrameLen, connection-level flow control and stream-level flow control. type loopyWriter struct { @@ -490,12 +511,13 @@ type loopyWriter struct { draining bool conn net.Conn logger *grpclog.PrefixLogger + bufferPool mem.BufferPool // Side-specific handlers ssGoAwayHandler func(*goAway) (bool, error) } -func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger, goAwayHandler func(*goAway) (bool, error)) *loopyWriter { +func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger, goAwayHandler func(*goAway) (bool, error), bufferPool mem.BufferPool) *loopyWriter { var buf bytes.Buffer l := &loopyWriter{ side: s, @@ -511,6 +533,7 @@ func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimato conn: conn, logger: logger, ssGoAwayHandler: goAwayHandler, + bufferPool: bufferPool, } return l } @@ -768,6 +791,11 @@ func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error { // not be established yet. delete(l.estdStreams, c.streamID) str.deleteSelf() + for head := str.itl.dequeueAll(); head != nil; head = head.next { + if df, ok := head.it.(*dataFrame); ok { + _ = df.reader.Close() + } + } } if c.rst { // If RST_STREAM needs to be sent. if err := l.framer.fr.WriteRSTStream(c.streamID, c.rstCode); err != nil { @@ -903,16 +931,18 @@ func (l *loopyWriter) processData() (bool, error) { dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream. // A data item is represented by a dataFrame, since it later translates into // multiple HTTP2 data frames. - // Every dataFrame has two buffers; h that keeps grpc-message header and d that is actual data. - // As an optimization to keep wire traffic low, data from d is copied to h to make as big as the - // maximum possible HTTP2 frame size. + // Every dataFrame has two buffers; h that keeps grpc-message header and data + // that is the actual message. As an optimization to keep wire traffic low, data + // from data is copied to h to make as big as the maximum possible HTTP2 frame + // size. - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // Empty data frame + if len(dataItem.h) == 0 && dataItem.reader.Remaining() == 0 { // Empty data frame // Client sends out empty data frame with endStream = true if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil { return false, err } str.itl.dequeue() // remove the empty data item from stream + _ = dataItem.reader.Close() if str.itl.isEmpty() { str.state = empty } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers. @@ -927,9 +957,7 @@ func (l *loopyWriter) processData() (bool, error) { } return false, nil } - var ( - buf []byte - ) + // Figure out the maximum size we can send maxSize := http2MaxFrameLen if strQuota := int(l.oiws) - str.bytesOutStanding; strQuota <= 0 { // stream-level flow control. @@ -943,43 +971,50 @@ func (l *loopyWriter) processData() (bool, error) { } // Compute how much of the header and data we can send within quota and max frame length hSize := min(maxSize, len(dataItem.h)) - dSize := min(maxSize-hSize, len(dataItem.d)) - if hSize != 0 { - if dSize == 0 { - buf = dataItem.h - } else { - // We can add some data to grpc message header to distribute bytes more equally across frames. - // Copy on the stack to avoid generating garbage - var localBuf [http2MaxFrameLen]byte - copy(localBuf[:hSize], dataItem.h) - copy(localBuf[hSize:], dataItem.d[:dSize]) - buf = localBuf[:hSize+dSize] - } + dSize := min(maxSize-hSize, dataItem.reader.Remaining()) + remainingBytes := len(dataItem.h) + dataItem.reader.Remaining() - hSize - dSize + size := hSize + dSize + + var buf *[]byte + + if hSize != 0 && dSize == 0 { + buf = &dataItem.h } else { - buf = dataItem.d - } + // Note: this is only necessary because the http2.Framer does not support + // partially writing a frame, so the sequence must be materialized into a buffer. + // TODO: Revisit once https://github.com/golang/go/issues/66655 is addressed. + pool := l.bufferPool + if pool == nil { + // Note that this is only supposed to be nil in tests. Otherwise, stream is + // always initialized with a BufferPool. + pool = mem.DefaultBufferPool() + } + buf = pool.Get(size) + defer pool.Put(buf) - size := hSize + dSize + copy((*buf)[:hSize], dataItem.h) + _, _ = dataItem.reader.Read((*buf)[hSize:]) + } // Now that outgoing flow controls are checked we can replenish str's write quota str.wq.replenish(size) var endStream bool // If this is the last data message on this stream and all of it can be written in this iteration. - if dataItem.endStream && len(dataItem.h)+len(dataItem.d) <= size { + if dataItem.endStream && remainingBytes == 0 { endStream = true } if dataItem.onEachWrite != nil { dataItem.onEachWrite() } - if err := l.framer.fr.WriteData(dataItem.streamID, endStream, buf[:size]); err != nil { + if err := l.framer.fr.WriteData(dataItem.streamID, endStream, (*buf)[:size]); err != nil { return false, err } str.bytesOutStanding += size l.sendQuota -= uint32(size) dataItem.h = dataItem.h[hSize:] - dataItem.d = dataItem.d[dSize:] - if len(dataItem.h) == 0 && len(dataItem.d) == 0 { // All the data from that message was written out. + if remainingBytes == 0 { // All the data from that message was written out. + _ = dataItem.reader.Close() str.itl.dequeue() } if str.itl.isEmpty() { diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 4a3ddce29a..e1cd86b2fc 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -24,7 +24,6 @@ package transport import ( - "bytes" "context" "errors" "fmt" @@ -40,6 +39,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcutil" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -50,7 +50,7 @@ import ( // NewServerHandlerTransport returns a ServerTransport handling gRPC from // inside an http.Handler, or writes an HTTP error to w and returns an error. // It requires that the http Server supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error) { +func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler, bufferPool mem.BufferPool) (ServerTransport, error) { if r.Method != http.MethodPost { w.Header().Set("Allow", http.MethodPost) msg := fmt.Sprintf("invalid gRPC request method %q", r.Method) @@ -98,6 +98,7 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []s contentType: contentType, contentSubtype: contentSubtype, stats: stats, + bufferPool: bufferPool, } st.logger = prefixLoggerForServerHandlerTransport(st) @@ -171,6 +172,8 @@ type serverHandlerTransport struct { stats []stats.Handler logger *grpclog.PrefixLogger + + bufferPool mem.BufferPool } func (ht *serverHandlerTransport) Close(err error) { @@ -244,6 +247,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro } s.hdrMu.Lock() + defer s.hdrMu.Unlock() if p := st.Proto(); p != nil && len(p.Details) > 0 { delete(s.trailer, grpcStatusDetailsBinHeader) stBytes, err := proto.Marshal(p) @@ -268,7 +272,6 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro } } } - s.hdrMu.Unlock() }) if err == nil { // transport has not been closed @@ -330,16 +333,28 @@ func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) { s.hdrMu.Unlock() } -func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { +func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { + // Always take a reference because otherwise there is no guarantee the data will + // be available after this function returns. This is what callers to Write + // expect. + data.Ref() headersWritten := s.updateHeaderSent() - return ht.do(func() { + err := ht.do(func() { + defer data.Free() if !headersWritten { ht.writePendingHeaders(s) } ht.rw.Write(hdr) - ht.rw.Write(data) + for _, b := range data { + _, _ = ht.rw.Write(b.ReadOnlyData()) + } ht.rw.(http.Flusher).Flush() }) + if err != nil { + data.Free() + return err + } + return nil } func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { @@ -406,7 +421,7 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream headerWireLength: 0, // won't have access to header wire length until golang/go#18997. } s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}}, + reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf}, windowHandler: func(int) {}, } @@ -415,21 +430,19 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream go func() { defer close(readerDone) - // TODO: minimize garbage, optimize recvBuffer code/ownership - const readSize = 8196 - for buf := make([]byte, readSize); ; { - n, err := req.Body.Read(buf) + for { + buf := ht.bufferPool.Get(http2MaxFrameLen) + n, err := req.Body.Read(*buf) if n > 0 { - s.buf.put(recvMsg{buffer: bytes.NewBuffer(buf[:n:n])}) - buf = buf[n:] + *buf = (*buf)[:n] + s.buf.put(recvMsg{buffer: mem.NewBuffer(buf, ht.bufferPool)}) + } else { + ht.bufferPool.Put(buf) } if err != nil { s.buf.put(recvMsg{err: mapRecvMsgError(err)}) return } - if len(buf) == 0 { - buf = make([]byte, readSize) - } } }() diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 3c63c70698..f46194fdc6 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -47,6 +47,7 @@ import ( isyscall "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/transport/networktype" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" @@ -59,6 +60,8 @@ import ( // atomically. var clientConnectionCounter uint64 +var goAwayLoopyWriterTimeout = 5 * time.Second + var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) // http2Client implements the ClientTransport interface with HTTP2. @@ -144,7 +147,7 @@ type http2Client struct { onClose func(GoAwayReason) - bufferPool *bufferPool + bufferPool mem.BufferPool connectionID uint64 logger *grpclog.PrefixLogger @@ -229,7 +232,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts } }(conn) - // The following defer and goroutine monitor the connectCtx for cancelation + // The following defer and goroutine monitor the connectCtx for cancellation // and deadline. On context expiration, the connection is hard closed and // this function will naturally fail as a result. Otherwise, the defer // waits for the goroutine to exit to prevent the context from being @@ -346,7 +349,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts streamQuota: defaultMaxStreamsClient, streamsQuotaAvailable: make(chan struct{}, 1), keepaliveEnabled: keepaliveEnabled, - bufferPool: newBufferPool(), + bufferPool: opts.BufferPool, onClose: onClose, } var czSecurity credentials.ChannelzSecurityValue @@ -463,7 +466,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts return nil, err } go func() { - t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler) + t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler, t.bufferPool) if err := t.loopy.run(); !isIOError(err) { // Immediately close the connection, as the loopy writer returns // when there are no more active streams and we were draining (the @@ -504,7 +507,6 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { closeStream: func(err error) { t.CloseStream(s, err) }, - freeBuffer: t.bufferPool.put, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) @@ -983,6 +985,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. // only once on a transport. Once it is called, the transport should not be // accessed anymore. func (t *http2Client) Close(err error) { + t.conn.SetWriteDeadline(time.Now().Add(time.Second * 10)) t.mu.Lock() // Make sure we only close once. if t.state == closing { @@ -1006,10 +1009,20 @@ func (t *http2Client) Close(err error) { t.kpDormancyCond.Signal() } t.mu.Unlock() + // Per HTTP/2 spec, a GOAWAY frame must be sent before closing the - // connection. See https://httpwg.org/specs/rfc7540.html#GOAWAY. + // connection. See https://httpwg.org/specs/rfc7540.html#GOAWAY. It + // also waits for loopyWriter to be closed with a timer to avoid the + // long blocking in case the connection is blackholed, i.e. TCP is + // just stuck. t.controlBuf.put(&goAway{code: http2.ErrCodeNo, debugData: []byte("client transport shutdown"), closeConn: err}) - <-t.writerDone + timer := time.NewTimer(goAwayLoopyWriterTimeout) + defer timer.Stop() + select { + case <-t.writerDone: // success + case <-timer.C: + t.logger.Infof("Failed to write a GOAWAY frame as part of connection close after %s. Giving up and closing the transport.", goAwayLoopyWriterTimeout) + } t.cancel() t.conn.Close() channelz.RemoveEntry(t.channelz.ID) @@ -1065,27 +1078,36 @@ func (t *http2Client) GracefulClose() { // Write formats the data into HTTP2 data frame(s) and sends it out. The caller // should proceed only if Write returns nil. -func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { +func (t *http2Client) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { + reader := data.Reader() + if opts.Last { // If it's the last message, update stream state. if !s.compareAndSwapState(streamActive, streamWriteDone) { + _ = reader.Close() return errStreamDone } } else if s.getState() != streamActive { + _ = reader.Close() return errStreamDone } df := &dataFrame{ streamID: s.id, endStream: opts.Last, h: hdr, - d: data, + reader: reader, } - if hdr != nil || data != nil { // If it's not an empty data frame, check quota. - if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { + if hdr != nil || df.reader.Remaining() != 0 { // If it's not an empty data frame, check quota. + if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil { + _ = reader.Close() return err } } - return t.controlBuf.put(df) + if err := t.controlBuf.put(df); err != nil { + _ = reader.Close() + return err + } + return nil } func (t *http2Client) getStream(f http2.Frame) *Stream { @@ -1190,10 +1212,13 @@ func (t *http2Client) handleData(f *http2.DataFrame) { // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? if len(f.Data()) > 0 { - buffer := t.bufferPool.get() - buffer.Reset() - buffer.Write(f.Data()) - s.write(recvMsg{buffer: buffer}) + pool := t.bufferPool + if pool == nil { + // Note that this is only supposed to be nil in tests. Otherwise, stream is + // always initialized with a BufferPool. + pool = mem.DefaultBufferPool() + } + s.write(recvMsg{buffer: mem.Copy(f.Data(), pool)}) } } // The server has closed the stream without sending trailers. Record that @@ -1222,7 +1247,7 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { if statusCode == codes.Canceled { if d, ok := s.ctx.Deadline(); ok && !d.After(time.Now()) { // Our deadline was already exceeded, and that was likely the cause - // of this cancelation. Alter the status code accordingly. + // of this cancellation. Alter the status code accordingly. statusCode = codes.DeadlineExceeded } } @@ -1307,7 +1332,7 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { id := f.LastStreamID if id > 0 && id%2 == 0 { t.mu.Unlock() - t.Close(connectionErrorf(true, nil, "received goaway with non-zero even-numbered numbered stream id: %v", id)) + t.Close(connectionErrorf(true, nil, "received goaway with non-zero even-numbered stream id: %v", id)) return } // A client can receive multiple GoAways from the server (see diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index b7091165b5..f5163f770c 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -39,6 +39,7 @@ import ( "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/internal/syscall" + "google.golang.org/grpc/mem" "google.golang.org/protobuf/proto" "google.golang.org/grpc/codes" @@ -119,7 +120,7 @@ type http2Server struct { // Fields below are for channelz metric collection. channelz *channelz.Socket - bufferPool *bufferPool + bufferPool mem.BufferPool connectionID uint64 @@ -261,7 +262,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, idle: time.Now(), kep: kep, initialWindowSize: iwz, - bufferPool: newBufferPool(), + bufferPool: config.BufferPool, } var czSecurity credentials.ChannelzSecurityValue if au, ok := authInfo.(credentials.ChannelzSecurityInfo); ok { @@ -330,7 +331,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, t.handleSettings(sf) go func() { - t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler) + t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst, t.conn, t.logger, t.outgoingGoAwayHandler, t.bufferPool) err := t.loopy.run() close(t.loopyWriterDone) if !isIOError(err) { @@ -613,10 +614,9 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.trReader = &transportReader{ reader: &recvBufferReader{ - ctx: s.ctx, - ctxDone: s.ctxDone, - recv: s.buf, - freeBuffer: t.bufferPool.put, + ctx: s.ctx, + ctxDone: s.ctxDone, + recv: s.buf, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) @@ -813,10 +813,13 @@ func (t *http2Server) handleData(f *http2.DataFrame) { // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? if len(f.Data()) > 0 { - buffer := t.bufferPool.get() - buffer.Reset() - buffer.Write(f.Data()) - s.write(recvMsg{buffer: buffer}) + pool := t.bufferPool + if pool == nil { + // Note that this is only supposed to be nil in tests. Otherwise, stream is + // always initialized with a BufferPool. + pool = mem.DefaultBufferPool() + } + s.write(recvMsg{buffer: mem.Copy(f.Data(), pool)}) } } if f.StreamEnded() { @@ -1089,7 +1092,9 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { onWrite: t.setResetPingStrikes, } - success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader) + success, err := t.controlBuf.executeAndPut(func() bool { + return t.checkForHeaderListSize(trailingHeader) + }, nil) if !success { if err != nil { return err @@ -1112,27 +1117,37 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { // Write converts the data into HTTP2 data frame and sends it out. Non-nil error // is returns if it fails (e.g., framing error, transport error). -func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { +func (t *http2Server) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { + reader := data.Reader() + if !s.isHeaderSent() { // Headers haven't been written yet. if err := t.WriteHeader(s, nil); err != nil { + _ = reader.Close() return err } } else { // Writing headers checks for this condition. if s.getState() == streamDone { + _ = reader.Close() return t.streamContextErr(s) } } + df := &dataFrame{ streamID: s.id, h: hdr, - d: data, + reader: reader, onEachWrite: t.setResetPingStrikes, } - if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { + if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil { + _ = reader.Close() return t.streamContextErr(s) } - return t.controlBuf.put(df) + if err := t.controlBuf.put(df); err != nil { + _ = reader.Close() + return err + } + return nil } // keepalive running in a separate goroutine does the following: diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 39cef3bd44..f609c6c665 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -317,28 +317,32 @@ func newBufWriter(conn net.Conn, batchSize int, pool *sync.Pool) *bufWriter { return w } -func (w *bufWriter) Write(b []byte) (n int, err error) { +func (w *bufWriter) Write(b []byte) (int, error) { if w.err != nil { return 0, w.err } if w.batchSize == 0 { // Buffer has been disabled. - n, err = w.conn.Write(b) + n, err := w.conn.Write(b) return n, toIOError(err) } if w.buf == nil { b := w.pool.Get().(*[]byte) w.buf = *b } + written := 0 for len(b) > 0 { - nn := copy(w.buf[w.offset:], b) - b = b[nn:] - w.offset += nn - n += nn - if w.offset >= w.batchSize { - err = w.flushKeepBuffer() + copied := copy(w.buf[w.offset:], b) + b = b[copied:] + written += copied + w.offset += copied + if w.offset < w.batchSize { + continue + } + if err := w.flushKeepBuffer(); err != nil { + return written, err } } - return n, err + return written, nil } func (w *bufWriter) Flush() error { diff --git a/vendor/google.golang.org/grpc/internal/transport/proxy.go b/vendor/google.golang.org/grpc/internal/transport/proxy.go index 24fa103257..54b2244365 100644 --- a/vendor/google.golang.org/grpc/internal/transport/proxy.go +++ b/vendor/google.golang.org/grpc/internal/transport/proxy.go @@ -107,8 +107,14 @@ func doHTTPConnectHandshake(ctx context.Context, conn net.Conn, backendAddr stri } return nil, fmt.Errorf("failed to do connect handshake, response: %q", dump) } - - return &bufConn{Conn: conn, r: r}, nil + // The buffer could contain extra bytes from the target server, so we can't + // discard it. However, in many cases where the server waits for the client + // to send the first message (e.g. when TLS is being used), the buffer will + // be empty, so we can avoid the overhead of reading through this buffer. + if r.Buffered() != 0 { + return &bufConn{Conn: conn, r: r}, nil + } + return conn, nil } // proxyDial dials, connecting to a proxy first if necessary. Checks if a proxy diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 4b39c0ade9..fdd6fa86cc 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -22,7 +22,6 @@ package transport import ( - "bytes" "context" "errors" "fmt" @@ -37,6 +36,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" @@ -47,32 +47,10 @@ import ( const logLevel = 2 -type bufferPool struct { - pool sync.Pool -} - -func newBufferPool() *bufferPool { - return &bufferPool{ - pool: sync.Pool{ - New: func() any { - return new(bytes.Buffer) - }, - }, - } -} - -func (p *bufferPool) get() *bytes.Buffer { - return p.pool.Get().(*bytes.Buffer) -} - -func (p *bufferPool) put(b *bytes.Buffer) { - p.pool.Put(b) -} - // recvMsg represents the received msg from the transport. All transport // protocol specific info has been removed. type recvMsg struct { - buffer *bytes.Buffer + buffer mem.Buffer // nil: received some data // io.EOF: stream is completed. data is nil. // other non-nil error: transport failure. data is nil. @@ -102,6 +80,9 @@ func newRecvBuffer() *recvBuffer { func (b *recvBuffer) put(r recvMsg) { b.mu.Lock() if b.err != nil { + // drop the buffer on the floor. Since b.err is not nil, any subsequent reads + // will always return an error, making this buffer inaccessible. + r.buffer.Free() b.mu.Unlock() // An error had occurred earlier, don't accept more // data or errors. @@ -148,45 +129,97 @@ type recvBufferReader struct { ctx context.Context ctxDone <-chan struct{} // cache of ctx.Done() (for performance). recv *recvBuffer - last *bytes.Buffer // Stores the remaining data in the previous calls. + last mem.Buffer // Stores the remaining data in the previous calls. err error - freeBuffer func(*bytes.Buffer) } -// Read reads the next len(p) bytes from last. If last is drained, it tries to -// read additional data from recv. It blocks if there no additional data available -// in recv. If Read returns any non-nil error, it will continue to return that error. -func (r *recvBufferReader) Read(p []byte) (n int, err error) { +func (r *recvBufferReader) ReadHeader(header []byte) (n int, err error) { if r.err != nil { return 0, r.err } if r.last != nil { - // Read remaining data left in last call. - copied, _ := r.last.Read(p) - if r.last.Len() == 0 { - r.freeBuffer(r.last) + n, r.last = mem.ReadUnsafe(header, r.last) + return n, nil + } + if r.closeStream != nil { + n, r.err = r.readHeaderClient(header) + } else { + n, r.err = r.readHeader(header) + } + return n, r.err +} + +// Read reads the next n bytes from last. If last is drained, it tries to read +// additional data from recv. It blocks if there no additional data available in +// recv. If Read returns any non-nil error, it will continue to return that +// error. +func (r *recvBufferReader) Read(n int) (buf mem.Buffer, err error) { + if r.err != nil { + return nil, r.err + } + if r.last != nil { + buf = r.last + if r.last.Len() > n { + buf, r.last = mem.SplitUnsafe(buf, n) + } else { r.last = nil } - return copied, nil + return buf, nil } if r.closeStream != nil { - n, r.err = r.readClient(p) + buf, r.err = r.readClient(n) } else { - n, r.err = r.read(p) + buf, r.err = r.read(n) } - return n, r.err + return buf, r.err } -func (r *recvBufferReader) read(p []byte) (n int, err error) { +func (r *recvBufferReader) readHeader(header []byte) (n int, err error) { select { case <-r.ctxDone: return 0, ContextErr(r.ctx.Err()) case m := <-r.recv.get(): - return r.readAdditional(m, p) + return r.readHeaderAdditional(m, header) + } +} + +func (r *recvBufferReader) read(n int) (buf mem.Buffer, err error) { + select { + case <-r.ctxDone: + return nil, ContextErr(r.ctx.Err()) + case m := <-r.recv.get(): + return r.readAdditional(m, n) + } +} + +func (r *recvBufferReader) readHeaderClient(header []byte) (n int, err error) { + // If the context is canceled, then closes the stream with nil metadata. + // closeStream writes its error parameter to r.recv as a recvMsg. + // r.readAdditional acts on that message and returns the necessary error. + select { + case <-r.ctxDone: + // Note that this adds the ctx error to the end of recv buffer, and + // reads from the head. This will delay the error until recv buffer is + // empty, thus will delay ctx cancellation in Recv(). + // + // It's done this way to fix a race between ctx cancel and trailer. The + // race was, stream.Recv() may return ctx error if ctxDone wins the + // race, but stream.Trailer() may return a non-nil md because the stream + // was not marked as done when trailer is received. This closeStream + // call will mark stream as done, thus fix the race. + // + // TODO: delaying ctx error seems like a unnecessary side effect. What + // we really want is to mark the stream as done, and return ctx error + // faster. + r.closeStream(ContextErr(r.ctx.Err())) + m := <-r.recv.get() + return r.readHeaderAdditional(m, header) + case m := <-r.recv.get(): + return r.readHeaderAdditional(m, header) } } -func (r *recvBufferReader) readClient(p []byte) (n int, err error) { +func (r *recvBufferReader) readClient(n int) (buf mem.Buffer, err error) { // If the context is canceled, then closes the stream with nil metadata. // closeStream writes its error parameter to r.recv as a recvMsg. // r.readAdditional acts on that message and returns the necessary error. @@ -207,25 +240,40 @@ func (r *recvBufferReader) readClient(p []byte) (n int, err error) { // faster. r.closeStream(ContextErr(r.ctx.Err())) m := <-r.recv.get() - return r.readAdditional(m, p) + return r.readAdditional(m, n) case m := <-r.recv.get(): - return r.readAdditional(m, p) + return r.readAdditional(m, n) } } -func (r *recvBufferReader) readAdditional(m recvMsg, p []byte) (n int, err error) { +func (r *recvBufferReader) readHeaderAdditional(m recvMsg, header []byte) (n int, err error) { r.recv.load() if m.err != nil { + if m.buffer != nil { + m.buffer.Free() + } return 0, m.err } - copied, _ := m.buffer.Read(p) - if m.buffer.Len() == 0 { - r.freeBuffer(m.buffer) - r.last = nil - } else { - r.last = m.buffer + + n, r.last = mem.ReadUnsafe(header, m.buffer) + + return n, nil +} + +func (r *recvBufferReader) readAdditional(m recvMsg, n int) (b mem.Buffer, err error) { + r.recv.load() + if m.err != nil { + if m.buffer != nil { + m.buffer.Free() + } + return nil, m.err + } + + if m.buffer.Len() > n { + m.buffer, r.last = mem.SplitUnsafe(m.buffer, n) } - return copied, nil + + return m.buffer, nil } type streamState uint32 @@ -241,7 +289,7 @@ const ( type Stream struct { id uint32 st ServerTransport // nil for client side Stream - ct *http2Client // nil for server side Stream + ct ClientTransport // nil for server side Stream ctx context.Context // the associated context of the stream cancel context.CancelFunc // always nil for client side Stream done chan struct{} // closed at the end of stream to unblock writers. On the client side. @@ -251,7 +299,7 @@ type Stream struct { recvCompress string sendCompress string buf *recvBuffer - trReader io.Reader + trReader *transportReader fc *inFlow wq *writeQuota @@ -408,7 +456,7 @@ func (s *Stream) TrailersOnly() bool { return s.noHeaders } -// Trailer returns the cached trailer metedata. Note that if it is not called +// Trailer returns the cached trailer metadata. Note that if it is not called // after the entire stream is done, it could return an empty MD. Client // side only. // It can be safely read only after stream has ended that is either read @@ -499,36 +547,87 @@ func (s *Stream) write(m recvMsg) { s.buf.put(m) } -// Read reads all p bytes from the wire for this stream. -func (s *Stream) Read(p []byte) (n int, err error) { +func (s *Stream) ReadHeader(header []byte) (err error) { + // Don't request a read if there was an error earlier + if er := s.trReader.er; er != nil { + return er + } + s.requestRead(len(header)) + for len(header) != 0 { + n, err := s.trReader.ReadHeader(header) + header = header[n:] + if len(header) == 0 { + err = nil + } + if err != nil { + if n > 0 && err == io.EOF { + err = io.ErrUnexpectedEOF + } + return err + } + } + return nil +} + +// Read reads n bytes from the wire for this stream. +func (s *Stream) Read(n int) (data mem.BufferSlice, err error) { // Don't request a read if there was an error earlier - if er := s.trReader.(*transportReader).er; er != nil { - return 0, er + if er := s.trReader.er; er != nil { + return nil, er } - s.requestRead(len(p)) - return io.ReadFull(s.trReader, p) + s.requestRead(n) + for n != 0 { + buf, err := s.trReader.Read(n) + var bufLen int + if buf != nil { + bufLen = buf.Len() + } + n -= bufLen + if n == 0 { + err = nil + } + if err != nil { + if bufLen > 0 && err == io.EOF { + err = io.ErrUnexpectedEOF + } + data.Free() + return nil, err + } + data = append(data, buf) + } + return data, nil } -// tranportReader reads all the data available for this Stream from the transport and +// transportReader reads all the data available for this Stream from the transport and // passes them into the decoder, which converts them into a gRPC message stream. // The error is io.EOF when the stream is done or another non-nil error if // the stream broke. type transportReader struct { - reader io.Reader + reader *recvBufferReader // The handler to control the window update procedure for both this // particular stream and the associated transport. windowHandler func(int) er error } -func (t *transportReader) Read(p []byte) (n int, err error) { - n, err = t.reader.Read(p) +func (t *transportReader) ReadHeader(header []byte) (int, error) { + n, err := t.reader.ReadHeader(header) if err != nil { t.er = err - return + return 0, err + } + t.windowHandler(len(header)) + return n, nil +} + +func (t *transportReader) Read(n int) (mem.Buffer, error) { + buf, err := t.reader.Read(n) + if err != nil { + t.er = err + return buf, err } - t.windowHandler(n) - return + t.windowHandler(buf.Len()) + return buf, nil } // BytesReceived indicates whether any bytes have been received on this stream. @@ -574,6 +673,7 @@ type ServerConfig struct { ChannelzParent *channelz.Server MaxHeaderListSize *uint32 HeaderTableSize *uint32 + BufferPool mem.BufferPool } // ConnectOptions covers all relevant options for communicating with the server. @@ -612,6 +712,8 @@ type ConnectOptions struct { MaxHeaderListSize *uint32 // UseProxy specifies if a proxy should be used. UseProxy bool + // The mem.BufferPool to use when reading/writing to the wire. + BufferPool mem.BufferPool } // NewClientTransport establishes the transport with the required ConnectOptions @@ -673,7 +775,7 @@ type ClientTransport interface { // Write sends the data for the given stream. A nil stream indicates // the write is to be performed on the transport as a whole. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error + Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error // NewStream creates a Stream for an RPC. NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) @@ -725,7 +827,7 @@ type ServerTransport interface { // Write sends the data for the given stream. // Write may not be called on all streams. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error + Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error // WriteStatus sends the status of a stream to the client. WriteStatus is // the final call made on a stream and always occurs. @@ -798,7 +900,7 @@ var ( // connection is draining. This could be caused by goaway or balancer // removing the address. errStreamDrain = status.Error(codes.Unavailable, "the connection is draining") - // errStreamDone is returned from write at the client side to indiacte application + // errStreamDone is returned from write at the client side to indicate application // layer of an error. errStreamDone = errors.New("the stream is done") // StatusGoAway indicates that the server sent a GOAWAY that included this diff --git a/vendor/google.golang.org/grpc/mem/buffer_pool.go b/vendor/google.golang.org/grpc/mem/buffer_pool.go new file mode 100644 index 0000000000..c37c58c023 --- /dev/null +++ b/vendor/google.golang.org/grpc/mem/buffer_pool.go @@ -0,0 +1,194 @@ +/* + * + * Copyright 2024 gRPC 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 mem + +import ( + "sort" + "sync" + + "google.golang.org/grpc/internal" +) + +// BufferPool is a pool of buffers that can be shared and reused, resulting in +// decreased memory allocation. +type BufferPool interface { + // Get returns a buffer with specified length from the pool. + Get(length int) *[]byte + + // Put returns a buffer to the pool. + Put(*[]byte) +} + +var defaultBufferPoolSizes = []int{ + 256, + 4 << 10, // 4KB (go page size) + 16 << 10, // 16KB (max HTTP/2 frame size used by gRPC) + 32 << 10, // 32KB (default buffer size for io.Copy) + 1 << 20, // 1MB +} + +var defaultBufferPool BufferPool + +func init() { + defaultBufferPool = NewTieredBufferPool(defaultBufferPoolSizes...) + + internal.SetDefaultBufferPoolForTesting = func(pool BufferPool) { + defaultBufferPool = pool + } + + internal.SetBufferPoolingThresholdForTesting = func(threshold int) { + bufferPoolingThreshold = threshold + } +} + +// DefaultBufferPool returns the current default buffer pool. It is a BufferPool +// created with NewBufferPool that uses a set of default sizes optimized for +// expected workflows. +func DefaultBufferPool() BufferPool { + return defaultBufferPool +} + +// NewTieredBufferPool returns a BufferPool implementation that uses multiple +// underlying pools of the given pool sizes. +func NewTieredBufferPool(poolSizes ...int) BufferPool { + sort.Ints(poolSizes) + pools := make([]*sizedBufferPool, len(poolSizes)) + for i, s := range poolSizes { + pools[i] = newSizedBufferPool(s) + } + return &tieredBufferPool{ + sizedPools: pools, + } +} + +// tieredBufferPool implements the BufferPool interface with multiple tiers of +// buffer pools for different sizes of buffers. +type tieredBufferPool struct { + sizedPools []*sizedBufferPool + fallbackPool simpleBufferPool +} + +func (p *tieredBufferPool) Get(size int) *[]byte { + return p.getPool(size).Get(size) +} + +func (p *tieredBufferPool) Put(buf *[]byte) { + p.getPool(cap(*buf)).Put(buf) +} + +func (p *tieredBufferPool) getPool(size int) BufferPool { + poolIdx := sort.Search(len(p.sizedPools), func(i int) bool { + return p.sizedPools[i].defaultSize >= size + }) + + if poolIdx == len(p.sizedPools) { + return &p.fallbackPool + } + + return p.sizedPools[poolIdx] +} + +// sizedBufferPool is a BufferPool implementation that is optimized for specific +// buffer sizes. For example, HTTP/2 frames within gRPC have a default max size +// of 16kb and a sizedBufferPool can be configured to only return buffers with a +// capacity of 16kb. Note that however it does not support returning larger +// buffers and in fact panics if such a buffer is requested. Because of this, +// this BufferPool implementation is not meant to be used on its own and rather +// is intended to be embedded in a tieredBufferPool such that Get is only +// invoked when the required size is smaller than or equal to defaultSize. +type sizedBufferPool struct { + pool sync.Pool + defaultSize int +} + +func (p *sizedBufferPool) Get(size int) *[]byte { + buf := p.pool.Get().(*[]byte) + b := *buf + clear(b[:cap(b)]) + *buf = b[:size] + return buf +} + +func (p *sizedBufferPool) Put(buf *[]byte) { + if cap(*buf) < p.defaultSize { + // Ignore buffers that are too small to fit in the pool. Otherwise, when + // Get is called it will panic as it tries to index outside the bounds + // of the buffer. + return + } + p.pool.Put(buf) +} + +func newSizedBufferPool(size int) *sizedBufferPool { + return &sizedBufferPool{ + pool: sync.Pool{ + New: func() any { + buf := make([]byte, size) + return &buf + }, + }, + defaultSize: size, + } +} + +var _ BufferPool = (*simpleBufferPool)(nil) + +// simpleBufferPool is an implementation of the BufferPool interface that +// attempts to pool buffers with a sync.Pool. When Get is invoked, it tries to +// acquire a buffer from the pool but if that buffer is too small, it returns it +// to the pool and creates a new one. +type simpleBufferPool struct { + pool sync.Pool +} + +func (p *simpleBufferPool) Get(size int) *[]byte { + bs, ok := p.pool.Get().(*[]byte) + if ok && cap(*bs) >= size { + *bs = (*bs)[:size] + return bs + } + + // A buffer was pulled from the pool, but it is too small. Put it back in + // the pool and create one large enough. + if ok { + p.pool.Put(bs) + } + + b := make([]byte, size) + return &b +} + +func (p *simpleBufferPool) Put(buf *[]byte) { + p.pool.Put(buf) +} + +var _ BufferPool = NopBufferPool{} + +// NopBufferPool is a buffer pool that returns new buffers without pooling. +type NopBufferPool struct{} + +// Get returns a buffer with specified length from the pool. +func (NopBufferPool) Get(length int) *[]byte { + b := make([]byte, length) + return &b +} + +// Put returns a buffer to the pool. +func (NopBufferPool) Put(*[]byte) { +} diff --git a/vendor/google.golang.org/grpc/mem/buffer_slice.go b/vendor/google.golang.org/grpc/mem/buffer_slice.go new file mode 100644 index 0000000000..228e9c2f20 --- /dev/null +++ b/vendor/google.golang.org/grpc/mem/buffer_slice.go @@ -0,0 +1,226 @@ +/* + * + * Copyright 2024 gRPC 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 mem + +import ( + "io" +) + +// BufferSlice offers a means to represent data that spans one or more Buffer +// instances. A BufferSlice is meant to be immutable after creation, and methods +// like Ref create and return copies of the slice. This is why all methods have +// value receivers rather than pointer receivers. +// +// Note that any of the methods that read the underlying buffers such as Ref, +// Len or CopyTo etc., will panic if any underlying buffers have already been +// freed. It is recommended to not directly interact with any of the underlying +// buffers directly, rather such interactions should be mediated through the +// various methods on this type. +// +// By convention, any APIs that return (mem.BufferSlice, error) should reduce +// the burden on the caller by never returning a mem.BufferSlice that needs to +// be freed if the error is non-nil, unless explicitly stated. +type BufferSlice []Buffer + +// Len returns the sum of the length of all the Buffers in this slice. +// +// # Warning +// +// Invoking the built-in len on a BufferSlice will return the number of buffers +// in the slice, and *not* the value returned by this function. +func (s BufferSlice) Len() int { + var length int + for _, b := range s { + length += b.Len() + } + return length +} + +// Ref invokes Ref on each buffer in the slice. +func (s BufferSlice) Ref() { + for _, b := range s { + b.Ref() + } +} + +// Free invokes Buffer.Free() on each Buffer in the slice. +func (s BufferSlice) Free() { + for _, b := range s { + b.Free() + } +} + +// CopyTo copies each of the underlying Buffer's data into the given buffer, +// returning the number of bytes copied. Has the same semantics as the copy +// builtin in that it will copy as many bytes as it can, stopping when either dst +// is full or s runs out of data, returning the minimum of s.Len() and len(dst). +func (s BufferSlice) CopyTo(dst []byte) int { + off := 0 + for _, b := range s { + off += copy(dst[off:], b.ReadOnlyData()) + } + return off +} + +// Materialize concatenates all the underlying Buffer's data into a single +// contiguous buffer using CopyTo. +func (s BufferSlice) Materialize() []byte { + l := s.Len() + if l == 0 { + return nil + } + out := make([]byte, l) + s.CopyTo(out) + return out +} + +// MaterializeToBuffer functions like Materialize except that it writes the data +// to a single Buffer pulled from the given BufferPool. +// +// As a special case, if the input BufferSlice only actually has one Buffer, this +// function simply increases the refcount before returning said Buffer. Freeing this +// buffer won't release it until the BufferSlice is itself released. +func (s BufferSlice) MaterializeToBuffer(pool BufferPool) Buffer { + if len(s) == 1 { + s[0].Ref() + return s[0] + } + sLen := s.Len() + if sLen == 0 { + return emptyBuffer{} + } + buf := pool.Get(sLen) + s.CopyTo(*buf) + return NewBuffer(buf, pool) +} + +// Reader returns a new Reader for the input slice after taking references to +// each underlying buffer. +func (s BufferSlice) Reader() Reader { + s.Ref() + return &sliceReader{ + data: s, + len: s.Len(), + } +} + +// Reader exposes a BufferSlice's data as an io.Reader, allowing it to interface +// with other parts systems. It also provides an additional convenience method +// Remaining(), which returns the number of unread bytes remaining in the slice. +// Buffers will be freed as they are read. +type Reader interface { + io.Reader + io.ByteReader + // Close frees the underlying BufferSlice and never returns an error. Subsequent + // calls to Read will return (0, io.EOF). + Close() error + // Remaining returns the number of unread bytes remaining in the slice. + Remaining() int +} + +type sliceReader struct { + data BufferSlice + len int + // The index into data[0].ReadOnlyData(). + bufferIdx int +} + +func (r *sliceReader) Remaining() int { + return r.len +} + +func (r *sliceReader) Close() error { + r.data.Free() + r.data = nil + r.len = 0 + return nil +} + +func (r *sliceReader) freeFirstBufferIfEmpty() bool { + if len(r.data) == 0 || r.bufferIdx != len(r.data[0].ReadOnlyData()) { + return false + } + + r.data[0].Free() + r.data = r.data[1:] + r.bufferIdx = 0 + return true +} + +func (r *sliceReader) Read(buf []byte) (n int, _ error) { + if r.len == 0 { + return 0, io.EOF + } + + for len(buf) != 0 && r.len != 0 { + // Copy as much as possible from the first Buffer in the slice into the + // given byte slice. + data := r.data[0].ReadOnlyData() + copied := copy(buf, data[r.bufferIdx:]) + r.len -= copied // Reduce len by the number of bytes copied. + r.bufferIdx += copied // Increment the buffer index. + n += copied // Increment the total number of bytes read. + buf = buf[copied:] // Shrink the given byte slice. + + // If we have copied all the data from the first Buffer, free it and advance to + // the next in the slice. + r.freeFirstBufferIfEmpty() + } + + return n, nil +} + +func (r *sliceReader) ReadByte() (byte, error) { + if r.len == 0 { + return 0, io.EOF + } + + // There may be any number of empty buffers in the slice, clear them all until a + // non-empty buffer is reached. This is guaranteed to exit since r.len is not 0. + for r.freeFirstBufferIfEmpty() { + } + + b := r.data[0].ReadOnlyData()[r.bufferIdx] + r.len-- + r.bufferIdx++ + // Free the first buffer in the slice if the last byte was read + r.freeFirstBufferIfEmpty() + return b, nil +} + +var _ io.Writer = (*writer)(nil) + +type writer struct { + buffers *BufferSlice + pool BufferPool +} + +func (w *writer) Write(p []byte) (n int, err error) { + b := Copy(p, w.pool) + *w.buffers = append(*w.buffers, b) + return b.Len(), nil +} + +// NewWriter wraps the given BufferSlice and BufferPool to implement the +// io.Writer interface. Every call to Write copies the contents of the given +// buffer into a new Buffer pulled from the given pool and the Buffer is added to +// the given BufferSlice. +func NewWriter(buffers *BufferSlice, pool BufferPool) io.Writer { + return &writer{buffers: buffers, pool: pool} +} diff --git a/vendor/google.golang.org/grpc/mem/buffers.go b/vendor/google.golang.org/grpc/mem/buffers.go new file mode 100644 index 0000000000..975ceb7185 --- /dev/null +++ b/vendor/google.golang.org/grpc/mem/buffers.go @@ -0,0 +1,252 @@ +/* + * + * Copyright 2024 gRPC 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 mem provides utilities that facilitate memory reuse in byte slices +// that are used as buffers. +// +// # Experimental +// +// Notice: All APIs in this package are EXPERIMENTAL and may be changed or +// removed in a later release. +package mem + +import ( + "fmt" + "sync" + "sync/atomic" +) + +// A Buffer represents a reference counted piece of data (in bytes) that can be +// acquired by a call to NewBuffer() or Copy(). A reference to a Buffer may be +// released by calling Free(), which invokes the free function given at creation +// only after all references are released. +// +// Note that a Buffer is not safe for concurrent access and instead each +// goroutine should use its own reference to the data, which can be acquired via +// a call to Ref(). +// +// Attempts to access the underlying data after releasing the reference to the +// Buffer will panic. +type Buffer interface { + // ReadOnlyData returns the underlying byte slice. Note that it is undefined + // behavior to modify the contents of this slice in any way. + ReadOnlyData() []byte + // Ref increases the reference counter for this Buffer. + Ref() + // Free decrements this Buffer's reference counter and frees the underlying + // byte slice if the counter reaches 0 as a result of this call. + Free() + // Len returns the Buffer's size. + Len() int + + split(n int) (left, right Buffer) + read(buf []byte) (int, Buffer) +} + +var ( + bufferPoolingThreshold = 1 << 10 + + bufferObjectPool = sync.Pool{New: func() any { return new(buffer) }} + refObjectPool = sync.Pool{New: func() any { return new(atomic.Int32) }} +) + +func IsBelowBufferPoolingThreshold(size int) bool { + return size <= bufferPoolingThreshold +} + +type buffer struct { + origData *[]byte + data []byte + refs *atomic.Int32 + pool BufferPool +} + +func newBuffer() *buffer { + return bufferObjectPool.Get().(*buffer) +} + +// NewBuffer creates a new Buffer from the given data, initializing the reference +// counter to 1. The data will then be returned to the given pool when all +// references to the returned Buffer are released. As a special case to avoid +// additional allocations, if the given buffer pool is nil, the returned buffer +// will be a "no-op" Buffer where invoking Buffer.Free() does nothing and the +// underlying data is never freed. +// +// Note that the backing array of the given data is not copied. +func NewBuffer(data *[]byte, pool BufferPool) Buffer { + if pool == nil || IsBelowBufferPoolingThreshold(len(*data)) { + return (SliceBuffer)(*data) + } + b := newBuffer() + b.origData = data + b.data = *data + b.pool = pool + b.refs = refObjectPool.Get().(*atomic.Int32) + b.refs.Add(1) + return b +} + +// Copy creates a new Buffer from the given data, initializing the reference +// counter to 1. +// +// It acquires a []byte from the given pool and copies over the backing array +// of the given data. The []byte acquired from the pool is returned to the +// pool when all references to the returned Buffer are released. +func Copy(data []byte, pool BufferPool) Buffer { + if IsBelowBufferPoolingThreshold(len(data)) { + buf := make(SliceBuffer, len(data)) + copy(buf, data) + return buf + } + + buf := pool.Get(len(data)) + copy(*buf, data) + return NewBuffer(buf, pool) +} + +func (b *buffer) ReadOnlyData() []byte { + if b.refs == nil { + panic("Cannot read freed buffer") + } + return b.data +} + +func (b *buffer) Ref() { + if b.refs == nil { + panic("Cannot ref freed buffer") + } + b.refs.Add(1) +} + +func (b *buffer) Free() { + if b.refs == nil { + panic("Cannot free freed buffer") + } + + refs := b.refs.Add(-1) + switch { + case refs > 0: + return + case refs == 0: + if b.pool != nil { + b.pool.Put(b.origData) + } + + refObjectPool.Put(b.refs) + b.origData = nil + b.data = nil + b.refs = nil + b.pool = nil + bufferObjectPool.Put(b) + default: + panic("Cannot free freed buffer") + } +} + +func (b *buffer) Len() int { + return len(b.ReadOnlyData()) +} + +func (b *buffer) split(n int) (Buffer, Buffer) { + if b.refs == nil { + panic("Cannot split freed buffer") + } + + b.refs.Add(1) + split := newBuffer() + split.origData = b.origData + split.data = b.data[n:] + split.refs = b.refs + split.pool = b.pool + + b.data = b.data[:n] + + return b, split +} + +func (b *buffer) read(buf []byte) (int, Buffer) { + if b.refs == nil { + panic("Cannot read freed buffer") + } + + n := copy(buf, b.data) + if n == len(b.data) { + b.Free() + return n, nil + } + + b.data = b.data[n:] + return n, b +} + +// String returns a string representation of the buffer. May be used for +// debugging purposes. +func (b *buffer) String() string { + return fmt.Sprintf("mem.Buffer(%p, data: %p, length: %d)", b, b.ReadOnlyData(), len(b.ReadOnlyData())) +} + +func ReadUnsafe(dst []byte, buf Buffer) (int, Buffer) { + return buf.read(dst) +} + +// SplitUnsafe modifies the receiver to point to the first n bytes while it +// returns a new reference to the remaining bytes. The returned Buffer functions +// just like a normal reference acquired using Ref(). +func SplitUnsafe(buf Buffer, n int) (left, right Buffer) { + return buf.split(n) +} + +type emptyBuffer struct{} + +func (e emptyBuffer) ReadOnlyData() []byte { + return nil +} + +func (e emptyBuffer) Ref() {} +func (e emptyBuffer) Free() {} + +func (e emptyBuffer) Len() int { + return 0 +} + +func (e emptyBuffer) split(n int) (left, right Buffer) { + return e, e +} + +func (e emptyBuffer) read(buf []byte) (int, Buffer) { + return 0, e +} + +type SliceBuffer []byte + +func (s SliceBuffer) ReadOnlyData() []byte { return s } +func (s SliceBuffer) Ref() {} +func (s SliceBuffer) Free() {} +func (s SliceBuffer) Len() int { return len(s) } + +func (s SliceBuffer) split(n int) (left, right Buffer) { + return s[:n], s[n:] +} + +func (s SliceBuffer) read(buf []byte) (int, Buffer) { + n := copy(buf, s) + if n == len(s) { + return n, nil + } + return n, s[n:] +} diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index 1e9485fd6e..d2e15253bb 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -213,11 +213,6 @@ func FromIncomingContext(ctx context.Context) (MD, bool) { // ValueFromIncomingContext returns the metadata value corresponding to the metadata // key from the incoming metadata if it exists. Keys are matched in a case insensitive // manner. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. func ValueFromIncomingContext(ctx context.Context, key string) []string { md, ok := ctx.Value(mdIncomingKey{}).(MD) if !ok { @@ -228,7 +223,7 @@ func ValueFromIncomingContext(ctx context.Context, key string) []string { return copyOf(v) } for k, v := range md { - // Case insenitive comparison: MD is a map, and there's no guarantee + // Case insensitive comparison: MD is a map, and there's no guarantee // that the MD attached to the context is created using our helper // functions. if strings.EqualFold(k, key) { diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go index 73bd633643..e87a17f36a 100644 --- a/vendor/google.golang.org/grpc/preloader.go +++ b/vendor/google.golang.org/grpc/preloader.go @@ -20,6 +20,7 @@ package grpc import ( "google.golang.org/grpc/codes" + "google.golang.org/grpc/mem" "google.golang.org/grpc/status" ) @@ -31,9 +32,10 @@ import ( // later release. type PreparedMsg struct { // Struct for preparing msg before sending them - encodedData []byte + encodedData mem.BufferSlice hdr []byte - payload []byte + payload mem.BufferSlice + pf payloadFormat } // Encode marshalls and compresses the message using the codec and compressor for the stream. @@ -57,11 +59,27 @@ func (p *PreparedMsg) Encode(s Stream, msg any) error { if err != nil { return err } - p.encodedData = data - compData, err := compress(data, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp) + + materializedData := data.Materialize() + data.Free() + p.encodedData = mem.BufferSlice{mem.NewBuffer(&materializedData, nil)} + + // TODO: it should be possible to grab the bufferPool from the underlying + // stream implementation with a type cast to its actual type (such as + // addrConnStream) and accessing the buffer pool directly. + var compData mem.BufferSlice + compData, p.pf, err = compress(p.encodedData, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp, mem.DefaultBufferPool()) if err != nil { return err } - p.hdr, p.payload = msgHeader(data, compData) + + if p.pf.isCompressed() { + materializedCompData := compData.Materialize() + compData.Free() + compData = mem.BufferSlice{mem.NewBuffer(&materializedCompData, nil)} + } + + p.hdr, p.payload = msgHeader(p.encodedData, compData, p.pf) + return nil } diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go index 666eda8e5f..73eb1745ae 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go @@ -22,7 +22,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc v5.27.1 // source: grpc/reflection/v1/reflection.proto package grpc_reflection_v1 diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go index 17d21fde22..0310828076 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go @@ -21,8 +21,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.1 // source: grpc/reflection/v1/reflection.proto package grpc_reflection_v1 @@ -36,8 +36,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo" @@ -49,7 +49,7 @@ const ( type ServerReflectionClient interface { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) + ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) } type serverReflectionClient struct { @@ -60,54 +60,39 @@ func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClie return &serverReflectionClient{cc} } -func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) { +func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &serverReflectionServerReflectionInfoClient{ClientStream: stream} + x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream} return x, nil } -type ServerReflection_ServerReflectionInfoClient interface { - Send(*ServerReflectionRequest) error - Recv() (*ServerReflectionResponse, error) - grpc.ClientStream -} - -type serverReflectionServerReflectionInfoClient struct { - grpc.ClientStream -} - -func (x *serverReflectionServerReflectionInfoClient) Send(m *ServerReflectionRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) { - m := new(ServerReflectionResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse] // ServerReflectionServer is the server API for ServerReflection service. // All implementations should embed UnimplementedServerReflectionServer -// for forward compatibility +// for forward compatibility. type ServerReflectionServer interface { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error + ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error } -// UnimplementedServerReflectionServer should be embedded to have forward compatible implementations. -type UnimplementedServerReflectionServer struct { -} +// UnimplementedServerReflectionServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedServerReflectionServer struct{} -func (UnimplementedServerReflectionServer) ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error { +func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error { return status.Errorf(codes.Unimplemented, "method ServerReflectionInfo not implemented") } +func (UnimplementedServerReflectionServer) testEmbeddedByValue() {} // UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServerReflectionServer will @@ -117,34 +102,22 @@ type UnsafeServerReflectionServer interface { } func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) { + // If the following call panics, it indicates UnimplementedServerReflectionServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&ServerReflection_ServiceDesc, srv) } func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ServerReflectionServer).ServerReflectionInfo(&serverReflectionServerReflectionInfoServer{ServerStream: stream}) -} - -type ServerReflection_ServerReflectionInfoServer interface { - Send(*ServerReflectionResponse) error - Recv() (*ServerReflectionRequest, error) - grpc.ServerStream -} - -type serverReflectionServerReflectionInfoServer struct { - grpc.ServerStream + return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream}) } -func (x *serverReflectionServerReflectionInfoServer) Send(m *ServerReflectionResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *serverReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) { - m := new(ServerReflectionRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse] // ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go index cd032acefc..4c488e5894 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -19,7 +19,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.1 -// protoc v4.25.2 +// protoc v5.27.1 // grpc/reflection/v1alpha/reflection.proto is a deprecated file. package grpc_reflection_v1alpha @@ -403,7 +403,7 @@ type ServerReflectionResponse_FileDescriptorResponse struct { } type ServerReflectionResponse_AllExtensionNumbersResponse struct { - // This message is used to answer all_extension_numbers_of_type requst. + // This message is used to answer all_extension_numbers_of_type request. // // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"` diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go index 93886e3821..80755d74d7 100644 --- a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go @@ -18,8 +18,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v4.25.2 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.1 // grpc/reflection/v1alpha/reflection.proto is a deprecated file. package grpc_reflection_v1alpha @@ -33,8 +33,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" @@ -46,7 +46,7 @@ const ( type ServerReflectionClient interface { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) + ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) } type serverReflectionClient struct { @@ -57,54 +57,39 @@ func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClie return &serverReflectionClient{cc} } -func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) { +func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &serverReflectionServerReflectionInfoClient{ClientStream: stream} + x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream} return x, nil } -type ServerReflection_ServerReflectionInfoClient interface { - Send(*ServerReflectionRequest) error - Recv() (*ServerReflectionResponse, error) - grpc.ClientStream -} - -type serverReflectionServerReflectionInfoClient struct { - grpc.ClientStream -} - -func (x *serverReflectionServerReflectionInfoClient) Send(m *ServerReflectionRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) { - m := new(ServerReflectionResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse] // ServerReflectionServer is the server API for ServerReflection service. // All implementations should embed UnimplementedServerReflectionServer -// for forward compatibility +// for forward compatibility. type ServerReflectionServer interface { // The reflection service is structured as a bidirectional stream, ensuring // all related requests go to a single server. - ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error + ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error } -// UnimplementedServerReflectionServer should be embedded to have forward compatible implementations. -type UnimplementedServerReflectionServer struct { -} +// UnimplementedServerReflectionServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedServerReflectionServer struct{} -func (UnimplementedServerReflectionServer) ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error { +func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error { return status.Errorf(codes.Unimplemented, "method ServerReflectionInfo not implemented") } +func (UnimplementedServerReflectionServer) testEmbeddedByValue() {} // UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ServerReflectionServer will @@ -114,34 +99,22 @@ type UnsafeServerReflectionServer interface { } func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) { + // If the following call panics, it indicates UnimplementedServerReflectionServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&ServerReflection_ServiceDesc, srv) } func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ServerReflectionServer).ServerReflectionInfo(&serverReflectionServerReflectionInfoServer{ServerStream: stream}) -} - -type ServerReflection_ServerReflectionInfoServer interface { - Send(*ServerReflectionResponse) error - Recv() (*ServerReflectionRequest, error) - grpc.ServerStream -} - -type serverReflectionServerReflectionInfoServer struct { - grpc.ServerStream + return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream}) } -func (x *serverReflectionServerReflectionInfoServer) Send(m *ServerReflectionResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *serverReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) { - m := new(ServerReflectionRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse] // ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/google.golang.org/grpc/reflection/internal/internal.go b/vendor/google.golang.org/grpc/reflection/internal/internal.go index 36ee650750..902fc6d35c 100644 --- a/vendor/google.golang.org/grpc/reflection/internal/internal.go +++ b/vendor/google.golang.org/grpc/reflection/internal/internal.go @@ -18,7 +18,7 @@ // Package internal contains code that is shared by both reflection package and // the test package. The packages are split in this way inorder to avoid -// depenedency to deprecated package github.com/golang/protobuf. +// dependency to deprecated package github.com/golang/protobuf. package internal import ( diff --git a/vendor/google.golang.org/grpc/regenerate.sh b/vendor/google.golang.org/grpc/regenerate.sh deleted file mode 100644 index 3edca296c2..0000000000 --- a/vendor/google.golang.org/grpc/regenerate.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# Copyright 2020 gRPC 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. - -set -eu -o pipefail - -WORKDIR=$(mktemp -d) - -function finish { - rm -rf "$WORKDIR" -} -trap finish EXIT - -export GOBIN=${WORKDIR}/bin -export PATH=${GOBIN}:${PATH} -mkdir -p ${GOBIN} - -echo "remove existing generated files" -# grpc_testing_not_regenerate/*.pb.go is not re-generated, -# see grpc_testing_not_regenerate/README.md for details. -rm -f $(find . -name '*.pb.go' | grep -v 'grpc_testing_not_regenerate') - -echo "go install google.golang.org/protobuf/cmd/protoc-gen-go" -(cd test/tools && go install google.golang.org/protobuf/cmd/protoc-gen-go) - -echo "go install cmd/protoc-gen-go-grpc" -(cd cmd/protoc-gen-go-grpc && go install .) - -echo "git clone https://github.com/grpc/grpc-proto" -git clone --quiet https://github.com/grpc/grpc-proto ${WORKDIR}/grpc-proto - -echo "git clone https://github.com/protocolbuffers/protobuf" -git clone --quiet https://github.com/protocolbuffers/protobuf ${WORKDIR}/protobuf - -# Pull in code.proto as a proto dependency -mkdir -p ${WORKDIR}/googleapis/google/rpc -echo "curl https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto" -curl --silent https://raw.githubusercontent.com/googleapis/googleapis/master/google/rpc/code.proto > ${WORKDIR}/googleapis/google/rpc/code.proto - -mkdir -p ${WORKDIR}/out - -# Generates sources without the embed requirement -LEGACY_SOURCES=( - ${WORKDIR}/grpc-proto/grpc/binlog/v1/binarylog.proto - ${WORKDIR}/grpc-proto/grpc/channelz/v1/channelz.proto - ${WORKDIR}/grpc-proto/grpc/health/v1/health.proto - ${WORKDIR}/grpc-proto/grpc/lb/v1/load_balancer.proto - profiling/proto/service.proto - ${WORKDIR}/grpc-proto/grpc/reflection/v1alpha/reflection.proto - ${WORKDIR}/grpc-proto/grpc/reflection/v1/reflection.proto -) - -# Generates only the new gRPC Service symbols -SOURCES=( - $(git ls-files --exclude-standard --cached --others "*.proto" | grep -v '^profiling/proto/service.proto$') - ${WORKDIR}/grpc-proto/grpc/gcp/altscontext.proto - ${WORKDIR}/grpc-proto/grpc/gcp/handshaker.proto - ${WORKDIR}/grpc-proto/grpc/gcp/transport_security_common.proto - ${WORKDIR}/grpc-proto/grpc/lookup/v1/rls.proto - ${WORKDIR}/grpc-proto/grpc/lookup/v1/rls_config.proto - ${WORKDIR}/grpc-proto/grpc/testing/*.proto - ${WORKDIR}/grpc-proto/grpc/core/*.proto -) - -# These options of the form 'Mfoo.proto=bar' instruct the codegen to use an -# import path of 'bar' in the generated code when 'foo.proto' is imported in -# one of the sources. -# -# Note that the protos listed here are all for testing purposes. All protos to -# be used externally should have a go_package option (and they don't need to be -# listed here). -OPTS=Mgrpc/core/stats.proto=google.golang.org/grpc/interop/grpc_testing/core,\ -Mgrpc/testing/benchmark_service.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/stats.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/report_qps_scenario_service.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/messages.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/worker_service.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/control.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/test.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/payloads.proto=google.golang.org/grpc/interop/grpc_testing,\ -Mgrpc/testing/empty.proto=google.golang.org/grpc/interop/grpc_testing - -for src in ${SOURCES[@]}; do - echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},use_generic_streams_experimental=true:${WORKDIR}/out \ - -I"." \ - -I${WORKDIR}/grpc-proto \ - -I${WORKDIR}/googleapis \ - -I${WORKDIR}/protobuf/src \ - ${src} -done - -for src in ${LEGACY_SOURCES[@]}; do - echo "protoc ${src}" - protoc --go_out=${OPTS}:${WORKDIR}/out --go-grpc_out=${OPTS},require_unimplemented_servers=false:${WORKDIR}/out \ - -I"." \ - -I${WORKDIR}/grpc-proto \ - -I${WORKDIR}/googleapis \ - -I${WORKDIR}/protobuf/src \ - ${src} -done - -# The go_package option in grpc/lookup/v1/rls.proto doesn't match the -# current location. Move it into the right place. -mkdir -p ${WORKDIR}/out/google.golang.org/grpc/internal/proto/grpc_lookup_v1 -mv ${WORKDIR}/out/google.golang.org/grpc/lookup/grpc_lookup_v1/* ${WORKDIR}/out/google.golang.org/grpc/internal/proto/grpc_lookup_v1 - -# grpc_testing_not_regenerate/*.pb.go are not re-generated, -# see grpc_testing_not_regenerate/README.md for details. -rm ${WORKDIR}/out/google.golang.org/grpc/reflection/test/grpc_testing_not_regenerate/*.pb.go - -cp -R ${WORKDIR}/out/google.golang.org/grpc/* . diff --git a/vendor/google.golang.org/grpc/resolver_wrapper.go b/vendor/google.golang.org/grpc/resolver_wrapper.go index c5fb45236f..23bb3fb258 100644 --- a/vendor/google.golang.org/grpc/resolver_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_wrapper.go @@ -66,7 +66,7 @@ func newCCResolverWrapper(cc *ClientConn) *ccResolverWrapper { // any newly created ccResolverWrapper, except that close may be called instead. func (ccr *ccResolverWrapper) start() error { errCh := make(chan error) - ccr.serializer.Schedule(func(ctx context.Context) { + ccr.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil { return } @@ -85,7 +85,7 @@ func (ccr *ccResolverWrapper) start() error { } func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOptions) { - ccr.serializer.Schedule(func(ctx context.Context) { + ccr.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || ccr.resolver == nil { return } @@ -102,7 +102,7 @@ func (ccr *ccResolverWrapper) close() { ccr.closed = true ccr.mu.Unlock() - ccr.serializer.Schedule(func(context.Context) { + ccr.serializer.TrySchedule(func(context.Context) { if ccr.resolver == nil { return } @@ -177,6 +177,9 @@ func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.P // addChannelzTraceEvent adds a channelz trace event containing the new // state received from resolver implementations. func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { + if !logger.V(0) && !channelz.IsOn() { + return + } var updates []string var oldSC, newSC *ServiceConfig var oldOK, newOK bool diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index fdd49e6e91..db8865ec3f 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -19,7 +19,6 @@ package grpc import ( - "bytes" "compress/gzip" "context" "encoding/binary" @@ -35,6 +34,7 @@ import ( "google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -271,17 +271,13 @@ func (o PeerCallOption) after(c *callInfo, attempt *csAttempt) { } } -// WaitForReady configures the action to take when an RPC is attempted on broken -// connections or unreachable servers. If waitForReady is false and the -// connection is in the TRANSIENT_FAILURE state, the RPC will fail -// immediately. Otherwise, the RPC client will block the call until a -// connection is available (or the call is canceled or times out) and will -// retry the call if it fails due to a transient error. gRPC will not retry if -// data was written to the wire unless the server indicates it did not process -// the data. Please refer to -// https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md. +// WaitForReady configures the RPC's behavior when the client is in +// TRANSIENT_FAILURE, which occurs when all addresses fail to connect. If +// waitForReady is false, the RPC will fail immediately. Otherwise, the client +// will wait until a connection becomes available or the RPC's deadline is +// reached. // -// By default, RPCs don't "wait for ready". +// By default, RPCs do not "wait for ready". func WaitForReady(waitForReady bool) CallOption { return FailFastCallOption{FailFast: !waitForReady} } @@ -515,11 +511,51 @@ type ForceCodecCallOption struct { } func (o ForceCodecCallOption) before(c *callInfo) error { - c.codec = o.Codec + c.codec = newCodecV1Bridge(o.Codec) return nil } func (o ForceCodecCallOption) after(c *callInfo, attempt *csAttempt) {} +// ForceCodecV2 returns a CallOption that will set codec to be used for all +// request and response messages for a call. The result of calling Name() will +// be used as the content-subtype after converting to lowercase, unless +// CallContentSubtype is also used. +// +// See Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. Also see the documentation on RegisterCodec and +// CallContentSubtype for more details on the interaction between Codec and +// content-subtype. +// +// This function is provided for advanced users; prefer to use only +// CallContentSubtype to select a registered codec instead. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func ForceCodecV2(codec encoding.CodecV2) CallOption { + return ForceCodecV2CallOption{CodecV2: codec} +} + +// ForceCodecV2CallOption is a CallOption that indicates the codec used for +// marshaling messages. +// +// # Experimental +// +// Notice: This type is EXPERIMENTAL and may be changed or removed in a +// later release. +type ForceCodecV2CallOption struct { + CodecV2 encoding.CodecV2 +} + +func (o ForceCodecV2CallOption) before(c *callInfo) error { + c.codec = o.CodecV2 + return nil +} + +func (o ForceCodecV2CallOption) after(c *callInfo, attempt *csAttempt) {} + // CallCustomCodec behaves like ForceCodec, but accepts a grpc.Codec instead of // an encoding.Codec. // @@ -540,7 +576,7 @@ type CustomCodecCallOption struct { } func (o CustomCodecCallOption) before(c *callInfo) error { - c.codec = o.Codec + c.codec = newCodecV0Bridge(o.Codec) return nil } func (o CustomCodecCallOption) after(c *callInfo, attempt *csAttempt) {} @@ -581,19 +617,28 @@ const ( compressionMade payloadFormat = 1 // compressed ) +func (pf payloadFormat) isCompressed() bool { + return pf == compressionMade +} + +type streamReader interface { + ReadHeader(header []byte) error + Read(n int) (mem.BufferSlice, error) +} + // parser reads complete gRPC messages from the underlying reader. type parser struct { // r is the underlying reader. // See the comment on recvMsg for the permissible // error types. - r io.Reader + r streamReader // The header of a gRPC message. Find more detail at // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md header [5]byte - // recvBufferPool is the pool of shared receive buffers. - recvBufferPool SharedBufferPool + // bufferPool is the pool of shared receive buffers. + bufferPool mem.BufferPool } // recvMsg reads a complete gRPC message from the stream. @@ -608,14 +653,15 @@ type parser struct { // - an error from the status package // // No other error values or types must be returned, which also means -// that the underlying io.Reader must not return an incompatible +// that the underlying streamReader must not return an incompatible // error. -func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byte, err error) { - if _, err := p.r.Read(p.header[:]); err != nil { +func (p *parser) recvMsg(maxReceiveMessageSize int) (payloadFormat, mem.BufferSlice, error) { + err := p.r.ReadHeader(p.header[:]) + if err != nil { return 0, nil, err } - pf = payloadFormat(p.header[0]) + pf := payloadFormat(p.header[0]) length := binary.BigEndian.Uint32(p.header[1:]) if length == 0 { @@ -627,20 +673,21 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt if int(length) > maxReceiveMessageSize { return 0, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", length, maxReceiveMessageSize) } - msg = p.recvBufferPool.Get(int(length)) - if _, err := p.r.Read(msg); err != nil { + + data, err := p.r.Read(int(length)) + if err != nil { if err == io.EOF { err = io.ErrUnexpectedEOF } return 0, nil, err } - return pf, msg, nil + return pf, data, nil } // encode serializes msg and returns a buffer containing the message, or an // error if it is too large to be transmitted by grpc. If msg is nil, it // generates an empty message. -func encode(c baseCodec, msg any) ([]byte, error) { +func encode(c baseCodec, msg any) (mem.BufferSlice, error) { if msg == nil { // NOTE: typed nils will not be caught by this check return nil, nil } @@ -648,7 +695,8 @@ func encode(c baseCodec, msg any) ([]byte, error) { if err != nil { return nil, status.Errorf(codes.Internal, "grpc: error while marshaling: %v", err.Error()) } - if uint(len(b)) > math.MaxUint32 { + if uint(b.Len()) > math.MaxUint32 { + b.Free() return nil, status.Errorf(codes.ResourceExhausted, "grpc: message too large (%d bytes)", len(b)) } return b, nil @@ -659,34 +707,41 @@ func encode(c baseCodec, msg any) ([]byte, error) { // indicating no compression was done. // // TODO(dfawley): eliminate cp parameter by wrapping Compressor in an encoding.Compressor. -func compress(in []byte, cp Compressor, compressor encoding.Compressor) ([]byte, error) { - if compressor == nil && cp == nil { - return nil, nil - } - if len(in) == 0 { - return nil, nil +func compress(in mem.BufferSlice, cp Compressor, compressor encoding.Compressor, pool mem.BufferPool) (mem.BufferSlice, payloadFormat, error) { + if (compressor == nil && cp == nil) || in.Len() == 0 { + return nil, compressionNone, nil } + var out mem.BufferSlice + w := mem.NewWriter(&out, pool) wrapErr := func(err error) error { + out.Free() return status.Errorf(codes.Internal, "grpc: error while compressing: %v", err.Error()) } - cbuf := &bytes.Buffer{} if compressor != nil { - z, err := compressor.Compress(cbuf) + z, err := compressor.Compress(w) if err != nil { - return nil, wrapErr(err) + return nil, 0, wrapErr(err) } - if _, err := z.Write(in); err != nil { - return nil, wrapErr(err) + for _, b := range in { + if _, err := z.Write(b.ReadOnlyData()); err != nil { + return nil, 0, wrapErr(err) + } } if err := z.Close(); err != nil { - return nil, wrapErr(err) + return nil, 0, wrapErr(err) } } else { - if err := cp.Do(cbuf, in); err != nil { - return nil, wrapErr(err) + // This is obviously really inefficient since it fully materializes the data, but + // there is no way around this with the old Compressor API. At least it attempts + // to return the buffer to the provider, in the hopes it can be reused (maybe + // even by a subsequent call to this very function). + buf := in.MaterializeToBuffer(pool) + defer buf.Free() + if err := cp.Do(w, buf.ReadOnlyData()); err != nil { + return nil, 0, wrapErr(err) } } - return cbuf.Bytes(), nil + return out, compressionMade, nil } const ( @@ -697,33 +752,36 @@ const ( // msgHeader returns a 5-byte header for the message being transmitted and the // payload, which is compData if non-nil or data otherwise. -func msgHeader(data, compData []byte) (hdr []byte, payload []byte) { +func msgHeader(data, compData mem.BufferSlice, pf payloadFormat) (hdr []byte, payload mem.BufferSlice) { hdr = make([]byte, headerLen) - if compData != nil { - hdr[0] = byte(compressionMade) - data = compData + hdr[0] = byte(pf) + + var length uint32 + if pf.isCompressed() { + length = uint32(compData.Len()) + payload = compData } else { - hdr[0] = byte(compressionNone) + length = uint32(data.Len()) + payload = data } // Write length of payload into buf - binary.BigEndian.PutUint32(hdr[payloadLen:], uint32(len(data))) - return hdr, data + binary.BigEndian.PutUint32(hdr[payloadLen:], length) + return hdr, payload } -func outPayload(client bool, msg any, data, payload []byte, t time.Time) *stats.OutPayload { +func outPayload(client bool, msg any, dataLength, payloadLength int, t time.Time) *stats.OutPayload { return &stats.OutPayload{ Client: client, Payload: msg, - Data: data, - Length: len(data), - WireLength: len(payload) + headerLen, - CompressedLength: len(payload), + Length: dataLength, + WireLength: payloadLength + headerLen, + CompressedLength: payloadLength, SentTime: t, } } -func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool) *status.Status { +func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool, isServer bool) *status.Status { switch pf { case compressionNone: case compressionMade: @@ -731,7 +789,11 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool return status.New(codes.Internal, "grpc: compressed flag set with identity or empty encoding") } if !haveCompressor { - return status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + if isServer { + return status.Newf(codes.Unimplemented, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + } else { + return status.Newf(codes.Internal, "grpc: Decompressor is not installed for grpc-encoding %q", recvCompress) + } } default: return status.Newf(codes.Internal, "grpc: received unexpected payload format %d", pf) @@ -741,104 +803,129 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool type payloadInfo struct { compressedLength int // The compressed length got from wire. - uncompressedBytes []byte + uncompressedBytes mem.BufferSlice +} + +func (p *payloadInfo) free() { + if p != nil && p.uncompressedBytes != nil { + p.uncompressedBytes.Free() + } } // recvAndDecompress reads a message from the stream, decompressing it if necessary. // // Cancelling the returned cancel function releases the buffer back to the pool. So the caller should cancel as soon as // the buffer is no longer needed. -func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, -) (uncompressedBuf []byte, cancel func(), err error) { - pf, compressedBuf, err := p.recvMsg(maxReceiveMessageSize) +// TODO: Refactor this function to reduce the number of arguments. +// See: https://google.github.io/styleguide/go/best-practices.html#function-argument-lists +func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, isServer bool, +) (out mem.BufferSlice, err error) { + pf, compressed, err := p.recvMsg(maxReceiveMessageSize) if err != nil { - return nil, nil, err + return nil, err } - if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil); st != nil { - return nil, nil, st.Err() + compressedLength := compressed.Len() + + if st := checkRecvPayload(pf, s.RecvCompress(), compressor != nil || dc != nil, isServer); st != nil { + compressed.Free() + return nil, st.Err() } var size int - if pf == compressionMade { + if pf.isCompressed() { + defer compressed.Free() + // To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor, // use this decompressor as the default. if dc != nil { - uncompressedBuf, err = dc.Do(bytes.NewReader(compressedBuf)) + var uncompressedBuf []byte + uncompressedBuf, err = dc.Do(compressed.Reader()) + if err == nil { + out = mem.BufferSlice{mem.NewBuffer(&uncompressedBuf, nil)} + } size = len(uncompressedBuf) } else { - uncompressedBuf, size, err = decompress(compressor, compressedBuf, maxReceiveMessageSize) + out, size, err = decompress(compressor, compressed, maxReceiveMessageSize, p.bufferPool) } if err != nil { - return nil, nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) + return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err) } if size > maxReceiveMessageSize { + out.Free() // TODO: Revisit the error code. Currently keep it consistent with java // implementation. - return nil, nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize) + return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max (%d vs. %d)", size, maxReceiveMessageSize) } } else { - uncompressedBuf = compressedBuf + out = compressed } if payInfo != nil { - payInfo.compressedLength = len(compressedBuf) - payInfo.uncompressedBytes = uncompressedBuf - - cancel = func() {} - } else { - cancel = func() { - p.recvBufferPool.Put(&compressedBuf) - } + payInfo.compressedLength = compressedLength + out.Ref() + payInfo.uncompressedBytes = out } - return uncompressedBuf, cancel, nil + return out, nil } // Using compressor, decompress d, returning data and size. // Optionally, if data will be over maxReceiveMessageSize, just return the size. -func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize int) ([]byte, int, error) { - dcReader, err := compressor.Decompress(bytes.NewReader(d)) +func decompress(compressor encoding.Compressor, d mem.BufferSlice, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, int, error) { + dcReader, err := compressor.Decompress(d.Reader()) if err != nil { return nil, 0, err } - if sizer, ok := compressor.(interface { - DecompressedSize(compressedBytes []byte) int - }); ok { - if size := sizer.DecompressedSize(d); size >= 0 { - if size > maxReceiveMessageSize { - return nil, size, nil - } - // size is used as an estimate to size the buffer, but we - // will read more data if available. - // +MinRead so ReadFrom will not reallocate if size is correct. - // - // TODO: If we ensure that the buffer size is the same as the DecompressedSize, - // we can also utilize the recv buffer pool here. - buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) - bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - return buf.Bytes(), int(bytesRead), err - } + + // TODO: Can/should this still be preserved with the new BufferSlice API? Are + // there any actual benefits to allocating a single large buffer instead of + // multiple smaller ones? + //if sizer, ok := compressor.(interface { + // DecompressedSize(compressedBytes []byte) int + //}); ok { + // if size := sizer.DecompressedSize(d); size >= 0 { + // if size > maxReceiveMessageSize { + // return nil, size, nil + // } + // // size is used as an estimate to size the buffer, but we + // // will read more data if available. + // // +MinRead so ReadFrom will not reallocate if size is correct. + // // + // // TODO: If we ensure that the buffer size is the same as the DecompressedSize, + // // we can also utilize the recv buffer pool here. + // buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead)) + // bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) + // return buf.Bytes(), int(bytesRead), err + // } + //} + + var out mem.BufferSlice + _, err = io.Copy(mem.NewWriter(&out, pool), io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) + if err != nil { + out.Free() + return nil, 0, err } - // Read from LimitReader with limit max+1. So if the underlying - // reader is over limit, the result will be bigger than max. - d, err = io.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1)) - return d, len(d), err + return out, out.Len(), nil } // For the two compressor parameters, both should not be set, but if they are, // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? -func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m any, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor) error { - buf, cancel, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor) +func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m any, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, isServer bool) error { + data, err := recvAndDecompress(p, s, dc, maxReceiveMessageSize, payInfo, compressor, isServer) if err != nil { return err } - defer cancel() - if err := c.Unmarshal(buf, m); err != nil { + // If the codec wants its own reference to the data, it can get it. Otherwise, always + // free the buffers. + defer data.Free() + + if err := c.Unmarshal(data, m); err != nil { return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message: %v", err) } + return nil } @@ -941,7 +1028,7 @@ func setCallInfoCodec(c *callInfo) error { // encoding.Codec (Name vs. String method name). We only support // setting content subtype from encoding.Codec to avoid a behavior // change with the deprecated version. - if ec, ok := c.codec.(encoding.Codec); ok { + if ec, ok := c.codec.(encoding.CodecV2); ok { c.contentSubtype = strings.ToLower(ec.Name()) } } @@ -950,12 +1037,12 @@ func setCallInfoCodec(c *callInfo) error { if c.contentSubtype == "" { // No codec specified in CallOptions; use proto by default. - c.codec = encoding.GetCodec(proto.Name) + c.codec = getCodec(proto.Name) return nil } // c.contentSubtype is already lowercased in CallContentSubtype - c.codec = encoding.GetCodec(c.contentSubtype) + c.codec = getCodec(c.contentSubtype) if c.codec == nil { return status.Errorf(codes.Internal, "no codec registered for content-subtype %s", c.contentSubtype) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 89f8e4792b..d1e1415a40 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -45,6 +45,7 @@ import ( "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -80,7 +81,7 @@ func init() { } internal.BinaryLogger = binaryLogger internal.JoinServerOptions = newJoinServerOption - internal.RecvBufferPool = recvBufferPool + internal.BufferPool = bufferPool } var statusOK = status.New(codes.OK, "") @@ -170,7 +171,7 @@ type serverOptions struct { maxHeaderListSize *uint32 headerTableSize *uint32 numServerWorkers uint32 - recvBufferPool SharedBufferPool + bufferPool mem.BufferPool waitForHandlers bool } @@ -181,7 +182,7 @@ var defaultServerOptions = serverOptions{ connectionTimeout: 120 * time.Second, writeBufferSize: defaultWriteBufSize, readBufferSize: defaultReadBufSize, - recvBufferPool: nopBufferPool{}, + bufferPool: mem.DefaultBufferPool(), } var globalServerOptions []ServerOption @@ -313,7 +314,7 @@ func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { // Will be supported throughout 1.x. func CustomCodec(codec Codec) ServerOption { return newFuncServerOption(func(o *serverOptions) { - o.codec = codec + o.codec = newCodecV0Bridge(codec) }) } @@ -342,7 +343,22 @@ func CustomCodec(codec Codec) ServerOption { // later release. func ForceServerCodec(codec encoding.Codec) ServerOption { return newFuncServerOption(func(o *serverOptions) { - o.codec = codec + o.codec = newCodecV1Bridge(codec) + }) +} + +// ForceServerCodecV2 is the equivalent of ForceServerCodec, but for the new +// CodecV2 interface. +// +// Will be supported throughout 1.x. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a +// later release. +func ForceServerCodecV2(codecV2 encoding.CodecV2) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.codec = codecV2 }) } @@ -592,26 +608,9 @@ func WaitForHandlers(w bool) ServerOption { }) } -// RecvBufferPool returns a ServerOption that configures the server -// to use the provided shared buffer pool for parsing incoming messages. Depending -// on the application's workload, this could result in reduced memory allocation. -// -// If you are unsure about how to implement a memory pool but want to utilize one, -// begin with grpc.NewSharedBufferPool. -// -// Note: The shared buffer pool feature will not be active if any of the following -// options are used: StatsHandler, EnableTracing, or binary logging. In such -// cases, the shared buffer pool will be ignored. -// -// Deprecated: use experimental.WithRecvBufferPool instead. Will be deleted in -// v1.60.0 or later. -func RecvBufferPool(bufferPool SharedBufferPool) ServerOption { - return recvBufferPool(bufferPool) -} - -func recvBufferPool(bufferPool SharedBufferPool) ServerOption { +func bufferPool(bufferPool mem.BufferPool) ServerOption { return newFuncServerOption(func(o *serverOptions) { - o.recvBufferPool = bufferPool + o.bufferPool = bufferPool }) } @@ -622,7 +621,7 @@ func recvBufferPool(bufferPool SharedBufferPool) ServerOption { // workload (assuming a QPS of a few thousand requests/sec). const serverWorkerResetThreshold = 1 << 16 -// serverWorkers blocks on a *transport.Stream channel forever and waits for +// serverWorker blocks on a *transport.Stream channel forever and waits for // data to be fed by serveStreams. This allows multiple requests to be // processed by the same goroutine, removing the need for expensive stack // re-allocations (see the runtime.morestack problem [1]). @@ -980,6 +979,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { ChannelzParent: s.channelz, MaxHeaderListSize: s.opts.maxHeaderListSize, HeaderTableSize: s.opts.headerTableSize, + BufferPool: s.opts.bufferPool, } st, err := transport.NewServerTransport(c, config) if err != nil { @@ -1072,7 +1072,7 @@ var _ http.Handler = (*Server)(nil) // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers) + st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers, s.opts.bufferPool) if err != nil { // Errors returned from transport.NewServerHandlerTransport have // already been written to w. @@ -1142,20 +1142,35 @@ func (s *Server) sendResponse(ctx context.Context, t transport.ServerTransport, channelz.Error(logger, s.channelz, "grpc: server failed to encode response: ", err) return err } - compData, err := compress(data, cp, comp) + + compData, pf, err := compress(data, cp, comp, s.opts.bufferPool) if err != nil { + data.Free() channelz.Error(logger, s.channelz, "grpc: server failed to compress response: ", err) return err } - hdr, payload := msgHeader(data, compData) + + hdr, payload := msgHeader(data, compData, pf) + + defer func() { + compData.Free() + data.Free() + // payload does not need to be freed here, it is either data or compData, both of + // which are already freed. + }() + + dataLen := data.Len() + payloadLen := payload.Len() // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > s.opts.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(payload), s.opts.maxSendMessageSize) + if payloadLen > s.opts.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", payloadLen, s.opts.maxSendMessageSize) } err = t.Write(stream, hdr, payload, opts) if err == nil { - for _, sh := range s.opts.statsHandlers { - sh.HandleRPC(ctx, outPayload(false, msg, data, payload, time.Now())) + if len(s.opts.statsHandlers) != 0 { + for _, sh := range s.opts.statsHandlers { + sh.HandleRPC(ctx, outPayload(false, msg, dataLen, payloadLen, time.Now())) + } } } return err @@ -1334,37 +1349,37 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor var payInfo *payloadInfo if len(shs) != 0 || len(binlogs) != 0 { payInfo = &payloadInfo{} + defer payInfo.free() } - d, cancel, err := recvAndDecompress(&parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp) + d, err := recvAndDecompress(&parser{r: stream, bufferPool: s.opts.bufferPool}, stream, dc, s.opts.maxReceiveMessageSize, payInfo, decomp, true) if err != nil { if e := t.WriteStatus(stream, status.Convert(err)); e != nil { channelz.Warningf(logger, s.channelz, "grpc: Server.processUnaryRPC failed to write status: %v", e) } return err } + defer d.Free() if channelz.IsOn() { t.IncrMsgRecv() } df := func(v any) error { - defer cancel() - if err := s.getCodec(stream.ContentSubtype()).Unmarshal(d, v); err != nil { return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } + for _, sh := range shs { sh.HandleRPC(ctx, &stats.InPayload{ RecvTime: time.Now(), Payload: v, - Length: len(d), + Length: d.Len(), WireLength: payInfo.compressedLength + headerLen, CompressedLength: payInfo.compressedLength, - Data: d, }) } if len(binlogs) != 0 { cm := &binarylog.ClientMessage{ - Message: d, + Message: d.Materialize(), } for _, binlog := range binlogs { binlog.Log(ctx, cm) @@ -1548,7 +1563,7 @@ func (s *Server) processStreamingRPC(ctx context.Context, t transport.ServerTran ctx: ctx, t: t, s: stream, - p: &parser{r: stream, recvBufferPool: s.opts.recvBufferPool}, + p: &parser{r: stream, bufferPool: s.opts.bufferPool}, codec: s.getCodec(stream.ContentSubtype()), maxReceiveMessageSize: s.opts.maxReceiveMessageSize, maxSendMessageSize: s.opts.maxSendMessageSize, @@ -1963,12 +1978,12 @@ func (s *Server) getCodec(contentSubtype string) baseCodec { return s.opts.codec } if contentSubtype == "" { - return encoding.GetCodec(proto.Name) + return getCodec(proto.Name) } - codec := encoding.GetCodec(contentSubtype) + codec := getCodec(contentSubtype) if codec == nil { logger.Warningf("Unsupported codec %q. Defaulting to %q for now. This will start to fail in future releases.", contentSubtype, proto.Name) - return encoding.GetCodec(proto.Name) + return getCodec(proto.Name) } return codec } diff --git a/vendor/google.golang.org/grpc/shared_buffer_pool.go b/vendor/google.golang.org/grpc/shared_buffer_pool.go deleted file mode 100644 index 48a64cfe8e..0000000000 --- a/vendor/google.golang.org/grpc/shared_buffer_pool.go +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * Copyright 2023 gRPC 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 grpc - -import "sync" - -// SharedBufferPool is a pool of buffers that can be shared, resulting in -// decreased memory allocation. Currently, in gRPC-go, it is only utilized -// for parsing incoming messages. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. -type SharedBufferPool interface { - // Get returns a buffer with specified length from the pool. - // - // The returned byte slice may be not zero initialized. - Get(length int) []byte - - // Put returns a buffer to the pool. - Put(*[]byte) -} - -// NewSharedBufferPool creates a simple SharedBufferPool with buckets -// of different sizes to optimize memory usage. This prevents the pool from -// wasting large amounts of memory, even when handling messages of varying sizes. -// -// # Experimental -// -// Notice: This API is EXPERIMENTAL and may be changed or removed in a -// later release. -func NewSharedBufferPool() SharedBufferPool { - return &simpleSharedBufferPool{ - pools: [poolArraySize]simpleSharedBufferChildPool{ - newBytesPool(level0PoolMaxSize), - newBytesPool(level1PoolMaxSize), - newBytesPool(level2PoolMaxSize), - newBytesPool(level3PoolMaxSize), - newBytesPool(level4PoolMaxSize), - newBytesPool(0), - }, - } -} - -// simpleSharedBufferPool is a simple implementation of SharedBufferPool. -type simpleSharedBufferPool struct { - pools [poolArraySize]simpleSharedBufferChildPool -} - -func (p *simpleSharedBufferPool) Get(size int) []byte { - return p.pools[p.poolIdx(size)].Get(size) -} - -func (p *simpleSharedBufferPool) Put(bs *[]byte) { - p.pools[p.poolIdx(cap(*bs))].Put(bs) -} - -func (p *simpleSharedBufferPool) poolIdx(size int) int { - switch { - case size <= level0PoolMaxSize: - return level0PoolIdx - case size <= level1PoolMaxSize: - return level1PoolIdx - case size <= level2PoolMaxSize: - return level2PoolIdx - case size <= level3PoolMaxSize: - return level3PoolIdx - case size <= level4PoolMaxSize: - return level4PoolIdx - default: - return levelMaxPoolIdx - } -} - -const ( - level0PoolMaxSize = 16 // 16 B - level1PoolMaxSize = level0PoolMaxSize * 16 // 256 B - level2PoolMaxSize = level1PoolMaxSize * 16 // 4 KB - level3PoolMaxSize = level2PoolMaxSize * 16 // 64 KB - level4PoolMaxSize = level3PoolMaxSize * 16 // 1 MB -) - -const ( - level0PoolIdx = iota - level1PoolIdx - level2PoolIdx - level3PoolIdx - level4PoolIdx - levelMaxPoolIdx - poolArraySize -) - -type simpleSharedBufferChildPool interface { - Get(size int) []byte - Put(any) -} - -type bufferPool struct { - sync.Pool - - defaultSize int -} - -func (p *bufferPool) Get(size int) []byte { - bs := p.Pool.Get().(*[]byte) - - if cap(*bs) < size { - p.Pool.Put(bs) - - return make([]byte, size) - } - - return (*bs)[:size] -} - -func newBytesPool(size int) simpleSharedBufferChildPool { - return &bufferPool{ - Pool: sync.Pool{ - New: func() any { - bs := make([]byte, size) - return &bs - }, - }, - defaultSize: size, - } -} - -// nopBufferPool is a buffer pool just makes new buffer without pooling. -type nopBufferPool struct { -} - -func (nopBufferPool) Get(length int) []byte { - return make([]byte, length) -} - -func (nopBufferPool) Put(*[]byte) { -} diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index fdb0bd6518..71195c4943 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -77,9 +77,6 @@ type InPayload struct { // the call to HandleRPC which provides the InPayload returns and must be // copied if needed later. Payload any - // Data is the serialized message payload. - // Deprecated: Data will be removed in the next release. - Data []byte // Length is the size of the uncompressed payload data. Does not include any // framing (gRPC or HTTP/2). @@ -150,9 +147,6 @@ type OutPayload struct { // the call to HandleRPC which provides the OutPayload returns and must be // copied if needed later. Payload any - // Data is the serialized message payload. - // Deprecated: Data will be removed in the next release. - Data []byte // Length is the size of the uncompressed payload data. Does not include any // framing (gRPC or HTTP/2). Length int diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 8051ef5b51..bb2b2a216c 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -41,6 +41,7 @@ import ( "google.golang.org/grpc/internal/serviceconfig" istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/transport" + "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -359,7 +360,7 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client cs.attempt = a return nil } - if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }); err != nil { + if err := cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op, nil) }); err != nil { return nil, err } @@ -517,7 +518,7 @@ func (a *csAttempt) newStream() error { } a.s = s a.ctx = s.Context() - a.p = &parser{r: s, recvBufferPool: a.cs.cc.dopts.recvBufferPool} + a.p = &parser{r: s, bufferPool: a.cs.cc.dopts.copts.BufferPool} return nil } @@ -566,10 +567,15 @@ type clientStream struct { // place where we need to check if the attempt is nil. attempt *csAttempt // TODO(hedging): hedging will have multiple attempts simultaneously. - committed bool // active attempt committed for retry? - onCommit func() - buffer []func(a *csAttempt) error // operations to replay on retry - bufferSize int // current size of buffer + committed bool // active attempt committed for retry? + onCommit func() + replayBuffer []replayOp // operations to replay on retry + replayBufferSize int // current size of replayBuffer +} + +type replayOp struct { + op func(a *csAttempt) error + cleanup func() } // csAttempt implements a single transport stream attempt within a @@ -607,7 +613,12 @@ func (cs *clientStream) commitAttemptLocked() { cs.onCommit() } cs.committed = true - cs.buffer = nil + for _, op := range cs.replayBuffer { + if op.cleanup != nil { + op.cleanup() + } + } + cs.replayBuffer = nil } func (cs *clientStream) commitAttempt() { @@ -732,7 +743,7 @@ func (cs *clientStream) retryLocked(attempt *csAttempt, lastErr error) error { // the stream is canceled. return err } - // Note that the first op in the replay buffer always sets cs.attempt + // Note that the first op in replayBuffer always sets cs.attempt // if it is able to pick a transport and create a stream. if lastErr = cs.replayBufferLocked(attempt); lastErr == nil { return nil @@ -761,7 +772,7 @@ func (cs *clientStream) withRetry(op func(a *csAttempt) error, onSuccess func()) // already be status errors. return toRPCErr(op(cs.attempt)) } - if len(cs.buffer) == 0 { + if len(cs.replayBuffer) == 0 { // For the first op, which controls creation of the stream and // assigns cs.attempt, we need to create a new attempt inline // before executing the first op. On subsequent ops, the attempt @@ -851,25 +862,26 @@ func (cs *clientStream) Trailer() metadata.MD { } func (cs *clientStream) replayBufferLocked(attempt *csAttempt) error { - for _, f := range cs.buffer { - if err := f(attempt); err != nil { + for _, f := range cs.replayBuffer { + if err := f.op(attempt); err != nil { return err } } return nil } -func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error) { +func (cs *clientStream) bufferForRetryLocked(sz int, op func(a *csAttempt) error, cleanup func()) { // Note: we still will buffer if retry is disabled (for transparent retries). if cs.committed { return } - cs.bufferSize += sz - if cs.bufferSize > cs.callInfo.maxRetryRPCBufferSize { + cs.replayBufferSize += sz + if cs.replayBufferSize > cs.callInfo.maxRetryRPCBufferSize { cs.commitAttemptLocked() + cleanup() return } - cs.buffer = append(cs.buffer, op) + cs.replayBuffer = append(cs.replayBuffer, replayOp{op: op, cleanup: cleanup}) } func (cs *clientStream) SendMsg(m any) (err error) { @@ -891,23 +903,50 @@ func (cs *clientStream) SendMsg(m any) (err error) { } // load hdr, payload, data - hdr, payload, data, err := prepareMsg(m, cs.codec, cs.cp, cs.comp) + hdr, data, payload, pf, err := prepareMsg(m, cs.codec, cs.cp, cs.comp, cs.cc.dopts.copts.BufferPool) if err != nil { return err } + defer func() { + data.Free() + // only free payload if compression was made, and therefore it is a different set + // of buffers from data. + if pf.isCompressed() { + payload.Free() + } + }() + + dataLen := data.Len() + payloadLen := payload.Len() // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > *cs.callInfo.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) + if payloadLen > *cs.callInfo.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payloadLen, *cs.callInfo.maxSendMessageSize) } + + // always take an extra ref in case data == payload (i.e. when the data isn't + // compressed). The original ref will always be freed by the deferred free above. + payload.Ref() op := func(a *csAttempt) error { - return a.sendMsg(m, hdr, payload, data) + return a.sendMsg(m, hdr, payload, dataLen, payloadLen) + } + + // onSuccess is invoked when the op is captured for a subsequent retry. If the + // stream was established by a previous message and therefore retries are + // disabled, onSuccess will not be invoked, and payloadRef can be freed + // immediately. + onSuccessCalled := false + err = cs.withRetry(op, func() { + cs.bufferForRetryLocked(len(hdr)+payloadLen, op, payload.Free) + onSuccessCalled = true + }) + if !onSuccessCalled { + payload.Free() } - err = cs.withRetry(op, func() { cs.bufferForRetryLocked(len(hdr)+len(payload), op) }) if len(cs.binlogs) != 0 && err == nil { cm := &binarylog.ClientMessage{ OnClientSide: true, - Message: data, + Message: data.Materialize(), } for _, binlog := range cs.binlogs { binlog.Log(cs.ctx, cm) @@ -924,6 +963,7 @@ func (cs *clientStream) RecvMsg(m any) error { var recvInfo *payloadInfo if len(cs.binlogs) != 0 { recvInfo = &payloadInfo{} + defer recvInfo.free() } err := cs.withRetry(func(a *csAttempt) error { return a.recvMsg(m, recvInfo) @@ -931,7 +971,7 @@ func (cs *clientStream) RecvMsg(m any) error { if len(cs.binlogs) != 0 && err == nil { sm := &binarylog.ServerMessage{ OnClientSide: true, - Message: recvInfo.uncompressedBytes, + Message: recvInfo.uncompressedBytes.Materialize(), } for _, binlog := range cs.binlogs { binlog.Log(cs.ctx, sm) @@ -958,7 +998,7 @@ func (cs *clientStream) CloseSend() error { // RecvMsg. This also matches historical behavior. return nil } - cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op) }) + cs.withRetry(op, func() { cs.bufferForRetryLocked(0, op, nil) }) if len(cs.binlogs) != 0 { chc := &binarylog.ClientHalfClose{ OnClientSide: true, @@ -1034,7 +1074,7 @@ func (cs *clientStream) finish(err error) { cs.cancel() } -func (a *csAttempt) sendMsg(m any, hdr, payld, data []byte) error { +func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength, payloadLength int) error { cs := a.cs if a.trInfo != nil { a.mu.Lock() @@ -1052,8 +1092,10 @@ func (a *csAttempt) sendMsg(m any, hdr, payld, data []byte) error { } return io.EOF } - for _, sh := range a.statsHandlers { - sh.HandleRPC(a.ctx, outPayload(true, m, data, payld, time.Now())) + if len(a.statsHandlers) != 0 { + for _, sh := range a.statsHandlers { + sh.HandleRPC(a.ctx, outPayload(true, m, dataLength, payloadLength, time.Now())) + } } if channelz.IsOn() { a.t.IncrMsgSent() @@ -1065,6 +1107,7 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { cs := a.cs if len(a.statsHandlers) != 0 && payInfo == nil { payInfo = &payloadInfo{} + defer payInfo.free() } if !a.decompSet { @@ -1083,8 +1126,7 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { // Only initialize this state once per stream. a.decompSet = true } - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decomp) - if err != nil { + if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decomp, false); err != nil { if err == io.EOF { if statusErr := a.s.Status().Err(); statusErr != nil { return statusErr @@ -1103,14 +1145,12 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { } for _, sh := range a.statsHandlers { sh.HandleRPC(a.ctx, &stats.InPayload{ - Client: true, - RecvTime: time.Now(), - Payload: m, - // TODO truncate large payload. - Data: payInfo.uncompressedBytes, + Client: true, + RecvTime: time.Now(), + Payload: m, WireLength: payInfo.compressedLength + headerLen, CompressedLength: payInfo.compressedLength, - Length: len(payInfo.uncompressedBytes), + Length: payInfo.uncompressedBytes.Len(), }) } if channelz.IsOn() { @@ -1122,14 +1162,12 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { } // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { + if err := recv(a.p, cs.codec, a.s, a.dc, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decomp, false); err == io.EOF { return a.s.Status().Err() // non-server streaming Recv returns nil on success + } else if err != nil { + return toRPCErr(err) } - return toRPCErr(err) + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) } func (a *csAttempt) finish(err error) { @@ -1185,12 +1223,12 @@ func (a *csAttempt) finish(err error) { a.mu.Unlock() } -// newClientStream creates a ClientStream with the specified transport, on the +// newNonRetryClientStream creates a ClientStream with the specified transport, on the // given addrConn. // // It's expected that the given transport is either the same one in addrConn, or // is already closed. To avoid race, transport is specified separately, instead -// of using ac.transpot. +// of using ac.transport. // // Main difference between this and ClientConn.NewStream: // - no retry @@ -1276,7 +1314,7 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin return nil, err } as.s = s - as.p = &parser{r: s, recvBufferPool: ac.dopts.recvBufferPool} + as.p = &parser{r: s, bufferPool: ac.dopts.copts.BufferPool} ac.incrCallsStarted() if desc != unaryStreamDesc { // Listen on stream context to cleanup when the stream context is @@ -1373,17 +1411,26 @@ func (as *addrConnStream) SendMsg(m any) (err error) { } // load hdr, payload, data - hdr, payld, _, err := prepareMsg(m, as.codec, as.cp, as.comp) + hdr, data, payload, pf, err := prepareMsg(m, as.codec, as.cp, as.comp, as.ac.dopts.copts.BufferPool) if err != nil { return err } + defer func() { + data.Free() + // only free payload if compression was made, and therefore it is a different set + // of buffers from data. + if pf.isCompressed() { + payload.Free() + } + }() + // TODO(dfawley): should we be checking len(data) instead? - if len(payld) > *as.callInfo.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payld), *as.callInfo.maxSendMessageSize) + if payload.Len() > *as.callInfo.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payload.Len(), *as.callInfo.maxSendMessageSize) } - if err := as.t.Write(as.s, hdr, payld, &transport.Options{Last: !as.desc.ClientStreams}); err != nil { + if err := as.t.Write(as.s, hdr, payload, &transport.Options{Last: !as.desc.ClientStreams}); err != nil { if !as.desc.ClientStreams { // For non-client-streaming RPCs, we return nil instead of EOF on error // because the generated code requires it. finish is not called; RecvMsg() @@ -1423,8 +1470,7 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { // Only initialize this state once per stream. as.decompSet = true } - err = recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp) - if err != nil { + if err := recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp, false); err != nil { if err == io.EOF { if statusErr := as.s.Status().Err(); statusErr != nil { return statusErr @@ -1444,14 +1490,12 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - err = recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } - if err == io.EOF { + if err := recv(as.p, as.codec, as.s, as.dc, m, *as.callInfo.maxReceiveMessageSize, nil, as.decomp, false); err == io.EOF { return as.s.Status().Err() // non-server streaming Recv returns nil on success + } else if err != nil { + return toRPCErr(err) } - return toRPCErr(err) + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) } func (as *addrConnStream) finish(err error) { @@ -1645,18 +1689,31 @@ func (ss *serverStream) SendMsg(m any) (err error) { } // load hdr, payload, data - hdr, payload, data, err := prepareMsg(m, ss.codec, ss.cp, ss.comp) + hdr, data, payload, pf, err := prepareMsg(m, ss.codec, ss.cp, ss.comp, ss.p.bufferPool) if err != nil { return err } + defer func() { + data.Free() + // only free payload if compression was made, and therefore it is a different set + // of buffers from data. + if pf.isCompressed() { + payload.Free() + } + }() + + dataLen := data.Len() + payloadLen := payload.Len() + // TODO(dfawley): should we be checking len(data) instead? - if len(payload) > ss.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) + if payloadLen > ss.maxSendMessageSize { + return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", payloadLen, ss.maxSendMessageSize) } if err := ss.t.Write(ss.s, hdr, payload, &transport.Options{Last: false}); err != nil { return toRPCErr(err) } + if len(ss.binlogs) != 0 { if !ss.serverHeaderBinlogged { h, _ := ss.s.Header() @@ -1669,7 +1726,7 @@ func (ss *serverStream) SendMsg(m any) (err error) { } } sm := &binarylog.ServerMessage{ - Message: data, + Message: data.Materialize(), } for _, binlog := range ss.binlogs { binlog.Log(ss.ctx, sm) @@ -1677,7 +1734,7 @@ func (ss *serverStream) SendMsg(m any) (err error) { } if len(ss.statsHandler) != 0 { for _, sh := range ss.statsHandler { - sh.HandleRPC(ss.s.Context(), outPayload(false, m, data, payload, time.Now())) + sh.HandleRPC(ss.s.Context(), outPayload(false, m, dataLen, payloadLen, time.Now())) } } return nil @@ -1714,8 +1771,9 @@ func (ss *serverStream) RecvMsg(m any) (err error) { var payInfo *payloadInfo if len(ss.statsHandler) != 0 || len(ss.binlogs) != 0 { payInfo = &payloadInfo{} + defer payInfo.free() } - if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp); err != nil { + if err := recv(ss.p, ss.codec, ss.s, ss.dc, m, ss.maxReceiveMessageSize, payInfo, ss.decomp, true); err != nil { if err == io.EOF { if len(ss.binlogs) != 0 { chc := &binarylog.ClientHalfClose{} @@ -1733,11 +1791,9 @@ func (ss *serverStream) RecvMsg(m any) (err error) { if len(ss.statsHandler) != 0 { for _, sh := range ss.statsHandler { sh.HandleRPC(ss.s.Context(), &stats.InPayload{ - RecvTime: time.Now(), - Payload: m, - // TODO truncate large payload. - Data: payInfo.uncompressedBytes, - Length: len(payInfo.uncompressedBytes), + RecvTime: time.Now(), + Payload: m, + Length: payInfo.uncompressedBytes.Len(), WireLength: payInfo.compressedLength + headerLen, CompressedLength: payInfo.compressedLength, }) @@ -1745,7 +1801,7 @@ func (ss *serverStream) RecvMsg(m any) (err error) { } if len(ss.binlogs) != 0 { cm := &binarylog.ClientMessage{ - Message: payInfo.uncompressedBytes, + Message: payInfo.uncompressedBytes.Materialize(), } for _, binlog := range ss.binlogs { binlog.Log(ss.ctx, cm) @@ -1760,23 +1816,26 @@ func MethodFromServerStream(stream ServerStream) (string, bool) { return Method(stream.Context()) } -// prepareMsg returns the hdr, payload and data -// using the compressors passed or using the -// passed preparedmsg -func prepareMsg(m any, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { +// prepareMsg returns the hdr, payload and data using the compressors passed or +// using the passed preparedmsg. The returned boolean indicates whether +// compression was made and therefore whether the payload needs to be freed in +// addition to the returned data. Freeing the payload if the returned boolean is +// false can lead to undefined behavior. +func prepareMsg(m any, codec baseCodec, cp Compressor, comp encoding.Compressor, pool mem.BufferPool) (hdr []byte, data, payload mem.BufferSlice, pf payloadFormat, err error) { if preparedMsg, ok := m.(*PreparedMsg); ok { - return preparedMsg.hdr, preparedMsg.payload, preparedMsg.encodedData, nil + return preparedMsg.hdr, preparedMsg.encodedData, preparedMsg.payload, preparedMsg.pf, nil } // The input interface is not a prepared msg. // Marshal and Compress the data at this point data, err = encode(codec, m) if err != nil { - return nil, nil, nil, err + return nil, nil, nil, 0, err } - compData, err := compress(data, cp, comp) + compData, pf, err := compress(data, cp, comp, pool) if err != nil { - return nil, nil, nil, err + data.Free() + return nil, nil, nil, 0, err } - hdr, payload = msgHeader(data, compData) - return hdr, payload, data, nil + hdr, payload = msgHeader(data, compData, pf) + return hdr, data, payload, pf, nil } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index bafaef99be..7c70005d08 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.65.0" +const Version = "1.66.2" diff --git a/vendor/k8s.io/kubernetes/pkg/features/kube_features.go b/vendor/k8s.io/kubernetes/pkg/features/kube_features.go index 80a25132bc..519d448dd5 100644 --- a/vendor/k8s.io/kubernetes/pkg/features/kube_features.go +++ b/vendor/k8s.io/kubernetes/pkg/features/kube_features.go @@ -235,8 +235,7 @@ const ( // owner: @HirazawaUi // kep: http://kep.k8s.io/4004 - // alpha: v1.29 - // beta: v1.31 + // Deprecated: v1.29 (default off) // DisableNodeKubeProxyVersion disable the status.nodeInfo.kubeProxyVersion field of v1.Node DisableNodeKubeProxyVersion featuregate.Feature = "DisableNodeKubeProxyVersion" @@ -1057,7 +1056,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS DisableKubeletCloudCredentialProviders: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - DisableNodeKubeProxyVersion: {Default: true, PreRelease: featuregate.Beta}, + DisableNodeKubeProxyVersion: {Default: false, PreRelease: featuregate.Deprecated}, // default on in 1.33 DevicePluginCDIDevices: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.33 diff --git a/vendor/k8s.io/kubernetes/test/utils/image/manifest.go b/vendor/k8s.io/kubernetes/test/utils/image/manifest.go index b93383a7a8..22de8316e8 100644 --- a/vendor/k8s.io/kubernetes/test/utils/image/manifest.go +++ b/vendor/k8s.io/kubernetes/test/utils/image/manifest.go @@ -229,7 +229,7 @@ func initImageConfigs(list RegistryList) (map[ImageID]Config, map[ImageID]Config configs[BusyBox] = Config{list.PromoterE2eRegistry, "busybox", "1.36.1-1"} configs[CudaVectorAdd] = Config{list.PromoterE2eRegistry, "cuda-vector-add", "1.0"} configs[CudaVectorAdd2] = Config{list.PromoterE2eRegistry, "cuda-vector-add", "2.3"} - configs[DistrolessIptables] = Config{list.BuildImageRegistry, "distroless-iptables", "v0.5.6"} + configs[DistrolessIptables] = Config{list.BuildImageRegistry, "distroless-iptables", "v0.5.9"} configs[Etcd] = Config{list.GcEtcdRegistry, "etcd", "3.5.15-0"} configs[Httpd] = Config{list.PromoterE2eRegistry, "httpd", "2.4.38-4"} configs[HttpdNew] = Config{list.PromoterE2eRegistry, "httpd", "2.4.39-4"} diff --git a/vendor/modules.txt b/vendor/modules.txt index 6e12bc5582..f889692954 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -465,7 +465,7 @@ golang.org/x/oauth2/internal ## explicit; go 1.18 golang.org/x/sync/errgroup golang.org/x/sync/singleflight -# golang.org/x/sys v0.23.0 +# golang.org/x/sys v0.24.0 ## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/plan9 @@ -541,7 +541,7 @@ google.golang.org/genproto/googleapis/api/httpbody ## explicit; go 1.21 google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.65.0 +# google.golang.org/grpc v1.66.2 ## explicit; go 1.21 google.golang.org/grpc google.golang.org/grpc/attributes @@ -560,7 +560,9 @@ google.golang.org/grpc/credentials/insecure google.golang.org/grpc/encoding google.golang.org/grpc/encoding/gzip google.golang.org/grpc/encoding/proto +google.golang.org/grpc/experimental/stats google.golang.org/grpc/grpclog +google.golang.org/grpc/grpclog/internal google.golang.org/grpc/health/grpc_health_v1 google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff @@ -583,11 +585,13 @@ google.golang.org/grpc/internal/resolver/dns/internal google.golang.org/grpc/internal/resolver/passthrough google.golang.org/grpc/internal/resolver/unix google.golang.org/grpc/internal/serviceconfig +google.golang.org/grpc/internal/stats google.golang.org/grpc/internal/status google.golang.org/grpc/internal/syscall google.golang.org/grpc/internal/transport google.golang.org/grpc/internal/transport/networktype google.golang.org/grpc/keepalive +google.golang.org/grpc/mem google.golang.org/grpc/metadata google.golang.org/grpc/peer google.golang.org/grpc/reflection @@ -662,7 +666,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.31.0 => k8s.io/api v0.31.0 +# k8s.io/api v0.31.1 => k8s.io/api v0.31.0 ## explicit; go 1.22.0 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -722,12 +726,12 @@ k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 k8s.io/api/storagemigration/v1alpha1 -# k8s.io/apiextensions-apiserver v0.31.0 => k8s.io/apiextensions-apiserver v0.31.0 +# k8s.io/apiextensions-apiserver v0.31.1 => k8s.io/apiextensions-apiserver v0.31.0 ## explicit; go 1.22.0 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/features -# k8s.io/apimachinery v0.31.0 => k8s.io/apimachinery v0.31.0 +# k8s.io/apimachinery v0.31.1 => k8s.io/apimachinery v0.31.0 ## explicit; go 1.22.0 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -945,7 +949,7 @@ k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook/metrics -# k8s.io/client-go v0.31.0 => k8s.io/client-go v0.31.0 +# k8s.io/client-go v0.31.1 => k8s.io/client-go v0.31.0 ## explicit; go 1.22.0 k8s.io/client-go/applyconfigurations k8s.io/client-go/applyconfigurations/admissionregistration/v1 @@ -1394,7 +1398,7 @@ k8s.io/kubectl/pkg/util/podutils # k8s.io/kubelet v0.31.0 => k8s.io/kubelet v0.31.0 ## explicit; go 1.22.0 k8s.io/kubelet/pkg/apis -# k8s.io/kubernetes v1.31.0 +# k8s.io/kubernetes v1.31.2 ## explicit; go 1.22.0 k8s.io/kubernetes/pkg/api/legacyscheme k8s.io/kubernetes/pkg/api/service @@ -1483,13 +1487,13 @@ k8s.io/utils/ptr k8s.io/utils/strings k8s.io/utils/strings/slices k8s.io/utils/trace -# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 +# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 ## explicit; go 1.21 sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client -# sigs.k8s.io/controller-runtime v0.19.0 +# sigs.k8s.io/controller-runtime v0.19.1 ## explicit; go 1.22.0 sigs.k8s.io/controller-runtime/pkg/client sigs.k8s.io/controller-runtime/pkg/client/apiutil @@ -1498,8 +1502,9 @@ sigs.k8s.io/controller-runtime/pkg/client/interceptor sigs.k8s.io/controller-runtime/pkg/internal/field/selector sigs.k8s.io/controller-runtime/pkg/internal/objectutil sigs.k8s.io/controller-runtime/pkg/log -# sigs.k8s.io/gateway-api v1.1.0 +# sigs.k8s.io/gateway-api v1.2.0 ## explicit; go 1.22.0 +sigs.k8s.io/gateway-api/apis/applyconfiguration sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1 sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2 sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3 @@ -1540,7 +1545,7 @@ sigs.k8s.io/json/internal/golang/encoding/json sigs.k8s.io/sig-storage-lib-external-provisioner/v10/controller sigs.k8s.io/sig-storage-lib-external-provisioner/v10/controller/metrics sigs.k8s.io/sig-storage-lib-external-provisioner/v10/util -# sigs.k8s.io/structured-merge-diff/v4 v4.4.1 +# sigs.k8s.io/structured-merge-diff/v4 v4.4.2 ## explicit; go 1.13 sigs.k8s.io/structured-merge-diff/v4/fieldpath sigs.k8s.io/structured-merge-diff/v4/merge diff --git a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go index da1e37c18b..0831f3e632 100644 --- a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go +++ b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go @@ -43,6 +43,7 @@ const ( PacketType_CLOSE_RSP PacketType = 3 PacketType_DATA PacketType = 4 PacketType_DIAL_CLS PacketType = 5 + PacketType_DRAIN PacketType = 6 ) // Enum value maps for PacketType. @@ -54,6 +55,7 @@ var ( 3: "CLOSE_RSP", 4: "DATA", 5: "DIAL_CLS", + 6: "DRAIN", } PacketType_value = map[string]int32{ "DIAL_REQ": 0, @@ -62,6 +64,7 @@ var ( "CLOSE_RSP": 3, "DATA": 4, "DIAL_CLS": 5, + "DRAIN": 6, } ) @@ -106,6 +109,7 @@ type Packet struct { // *Packet_CloseRequest // *Packet_CloseResponse // *Packet_CloseDial + // *Packet_Drain Payload isPacket_Payload `protobuf_oneof:"payload"` } @@ -197,6 +201,13 @@ func (x *Packet) GetCloseDial() *CloseDial { return nil } +func (x *Packet) GetDrain() *Drain { + if x, ok := x.GetPayload().(*Packet_Drain); ok { + return x.Drain + } + return nil +} + type isPacket_Payload interface { isPacket_Payload() } @@ -225,6 +236,10 @@ type Packet_CloseDial struct { CloseDial *CloseDial `protobuf:"bytes,7,opt,name=closeDial,proto3,oneof"` } +type Packet_Drain struct { + Drain *Drain `protobuf:"bytes,8,opt,name=drain,proto3,oneof"` +} + func (*Packet_DialRequest) isPacket_Payload() {} func (*Packet_DialResponse) isPacket_Payload() {} @@ -237,6 +252,8 @@ func (*Packet_CloseResponse) isPacket_Payload() {} func (*Packet_CloseDial) isPacket_Payload() {} +func (*Packet_Drain) isPacket_Payload() {} + type DialRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -522,6 +539,44 @@ func (x *CloseDial) GetRandom() int64 { return 0 } +type Drain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Drain) Reset() { + *x = Drain{} + if protoimpl.UnsafeEnabled { + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Drain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Drain) ProtoMessage() {} + +func (x *Drain) ProtoReflect() protoreflect.Message { + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Drain.ProtoReflect.Descriptor instead. +func (*Drain) Descriptor() ([]byte, []int) { + return file_konnectivity_client_proto_client_client_proto_rawDescGZIP(), []int{6} +} + type Data struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -538,7 +593,7 @@ type Data struct { func (x *Data) Reset() { *x = Data{} if protoimpl.UnsafeEnabled { - mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -551,7 +606,7 @@ func (x *Data) String() string { func (*Data) ProtoMessage() {} func (x *Data) ProtoReflect() protoreflect.Message { - mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[6] + mi := &file_konnectivity_client_proto_client_client_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -564,7 +619,7 @@ func (x *Data) ProtoReflect() protoreflect.Message { // Deprecated: Use Data.ProtoReflect.Descriptor instead. func (*Data) Descriptor() ([]byte, []int) { - return file_konnectivity_client_proto_client_client_proto_rawDescGZIP(), []int{6} + return file_konnectivity_client_proto_client_client_proto_rawDescGZIP(), []int{7} } func (x *Data) GetConnectID() int64 { @@ -594,7 +649,7 @@ var file_konnectivity_client_proto_client_client_proto_rawDesc = []byte{ 0x0a, 0x2d, 0x6b, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xd1, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x79, + 0xf1, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x64, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, @@ -614,7 +669,9 @@ var file_konnectivity_client_proto_client_client_proto_rawDesc = []byte{ 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x09, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x48, 0x00, 0x52, 0x09, 0x63, - 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, + 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x12, 0x1e, 0x0a, 0x05, 0x64, 0x72, 0x61, 0x69, + 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x44, 0x72, 0x61, 0x69, 0x6e, 0x48, + 0x00, 0x52, 0x05, 0x64, 0x72, 0x61, 0x69, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x5b, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x18, @@ -636,26 +693,27 @@ var file_konnectivity_client_proto_client_client_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x44, 0x22, 0x23, 0x0a, 0x09, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x61, - 0x6e, 0x64, 0x6f, 0x6d, 0x22, 0x4e, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, - 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x2a, 0x5e, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x00, - 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x52, 0x53, 0x50, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x02, 0x12, 0x0d, 0x0a, - 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, 0x52, 0x53, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, - 0x44, 0x41, 0x54, 0x41, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x43, - 0x4c, 0x53, 0x10, 0x05, 0x32, 0x2f, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x07, 0x2e, - 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x22, - 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x73, 0x69, 0x67, 0x73, 0x2e, 0x6b, 0x38, - 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6b, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x64, 0x6f, 0x6d, 0x22, 0x07, 0x0a, 0x05, 0x44, 0x72, 0x61, 0x69, 0x6e, 0x22, 0x4e, 0x0a, + 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x69, 0x0a, + 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x44, + 0x49, 0x41, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, + 0x4c, 0x5f, 0x52, 0x53, 0x50, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, + 0x5f, 0x52, 0x45, 0x51, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x5f, + 0x52, 0x53, 0x50, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x04, 0x12, + 0x0c, 0x0a, 0x08, 0x44, 0x49, 0x41, 0x4c, 0x5f, 0x43, 0x4c, 0x53, 0x10, 0x05, 0x12, 0x09, 0x0a, + 0x05, 0x44, 0x52, 0x41, 0x49, 0x4e, 0x10, 0x06, 0x32, 0x2f, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, + 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, + 0x79, 0x12, 0x07, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x07, 0x2e, 0x50, 0x61, 0x63, + 0x6b, 0x65, 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x46, 0x5a, 0x44, 0x73, 0x69, 0x67, + 0x73, 0x2e, 0x6b, 0x38, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2d, 0x70, 0x72, 0x6f, 0x78, 0x79, + 0x2f, 0x6b, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2d, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -671,7 +729,7 @@ func file_konnectivity_client_proto_client_client_proto_rawDescGZIP() []byte { } var file_konnectivity_client_proto_client_client_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_konnectivity_client_proto_client_client_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_konnectivity_client_proto_client_client_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_konnectivity_client_proto_client_client_proto_goTypes = []interface{}{ (PacketType)(0), // 0: PacketType (*Packet)(nil), // 1: Packet @@ -680,23 +738,25 @@ var file_konnectivity_client_proto_client_client_proto_goTypes = []interface{}{ (*CloseRequest)(nil), // 4: CloseRequest (*CloseResponse)(nil), // 5: CloseResponse (*CloseDial)(nil), // 6: CloseDial - (*Data)(nil), // 7: Data + (*Drain)(nil), // 7: Drain + (*Data)(nil), // 8: Data } var file_konnectivity_client_proto_client_client_proto_depIdxs = []int32{ 0, // 0: Packet.type:type_name -> PacketType 2, // 1: Packet.dialRequest:type_name -> DialRequest 3, // 2: Packet.dialResponse:type_name -> DialResponse - 7, // 3: Packet.data:type_name -> Data + 8, // 3: Packet.data:type_name -> Data 4, // 4: Packet.closeRequest:type_name -> CloseRequest 5, // 5: Packet.closeResponse:type_name -> CloseResponse 6, // 6: Packet.closeDial:type_name -> CloseDial - 1, // 7: ProxyService.Proxy:input_type -> Packet - 1, // 8: ProxyService.Proxy:output_type -> Packet - 8, // [8:9] is the sub-list for method output_type - 7, // [7:8] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 7, // 7: Packet.drain:type_name -> Drain + 1, // 8: ProxyService.Proxy:input_type -> Packet + 1, // 9: ProxyService.Proxy:output_type -> Packet + 9, // [9:10] is the sub-list for method output_type + 8, // [8:9] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_konnectivity_client_proto_client_client_proto_init() } @@ -778,6 +838,18 @@ func file_konnectivity_client_proto_client_client_proto_init() { } } file_konnectivity_client_proto_client_client_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Drain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_konnectivity_client_proto_client_client_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Data); i { case 0: return &v.state @@ -797,6 +869,7 @@ func file_konnectivity_client_proto_client_client_proto_init() { (*Packet_CloseRequest)(nil), (*Packet_CloseResponse)(nil), (*Packet_CloseDial)(nil), + (*Packet_Drain)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -804,7 +877,7 @@ func file_konnectivity_client_proto_client_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_konnectivity_client_proto_client_client_proto_rawDesc, NumEnums: 1, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto index 811278e62d..006e0ac83c 100644 --- a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto +++ b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.proto @@ -30,6 +30,7 @@ enum PacketType { CLOSE_RSP = 3; DATA = 4; DIAL_CLS = 5; + DRAIN = 6; } message Packet { @@ -42,6 +43,7 @@ message Packet { CloseRequest closeRequest = 5; CloseResponse closeResponse = 6; CloseDial closeDial = 7; + Drain drain = 8; } } @@ -85,6 +87,11 @@ message CloseDial { int64 random = 1; } +message Drain { + // A hint from an Agent to Server that it is pending termination. + // A Server should prefer non-draining agents for new dials. +} + message Data { // connectID to connect to int64 connectID = 1; diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go index 7366a18528..54f5b5d258 100644 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go +++ b/vendor/sigs.k8s.io/controller-runtime/pkg/client/fake/client.go @@ -68,16 +68,21 @@ type versionedTracker struct { } type fakeClient struct { - tracker versionedTracker - scheme *runtime.Scheme + // trackerWriteLock must be acquired before writing to + // the tracker or performing reads that affect a following + // write. + trackerWriteLock sync.Mutex + tracker versionedTracker + + schemeWriteLock sync.Mutex + scheme *runtime.Scheme + restMapper meta.RESTMapper withStatusSubresource sets.Set[schema.GroupVersionKind] // indexes maps each GroupVersionKind (GVK) to the indexes registered for that GVK. // The inner map maps from index name to IndexerFunc. indexes map[schema.GroupVersionKind]map[string]client.IndexerFunc - - schemeWriteLock sync.Mutex } var _ client.WithWatch = &fakeClient{} @@ -467,6 +472,11 @@ func (t versionedTracker) updateObject(gvr schema.GroupVersionResource, obj runt switch { case allowsUnconditionalUpdate(gvk): accessor.SetResourceVersion(oldAccessor.GetResourceVersion()) + // This is needed because if the patch explicitly sets the RV to null, the client-go reaction we use + // to apply it and whose output we process here will have it unset. It is not clear why the Kubernetes + // apiserver accepts such a patch, but it does so we just copy that behavior. + // Kubernetes apiserver behavior can be checked like this: + // `kubectl patch configmap foo --patch '{"metadata":{"annotations":{"foo":"bar"},"resourceVersion":null}}' -v=9` case bytes. Contains(debug.Stack(), []byte("sigs.k8s.io/controller-runtime/pkg/client/fake.(*fakeClient).Patch")): // We apply patches using a client-go reaction that ends up calling the trackers Update. As we can't change @@ -508,7 +518,10 @@ func (c *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.O return err } - if _, isUnstructured := obj.(runtime.Unstructured); isUnstructured { + _, isUnstructured := obj.(runtime.Unstructured) + _, isPartialObject := obj.(*metav1.PartialObjectMetadata) + + if isUnstructured || isPartialObject { gvk, err := apiutil.GVKForObject(obj, c.scheme) if err != nil { return err @@ -729,6 +742,8 @@ func (c *fakeClient) Create(ctx context.Context, obj client.Object, opts ...clie accessor.SetDeletionTimestamp(nil) } + c.trackerWriteLock.Lock() + defer c.trackerWriteLock.Unlock() return c.tracker.Create(gvr, obj, accessor.GetNamespace()) } @@ -750,6 +765,8 @@ func (c *fakeClient) Delete(ctx context.Context, obj client.Object, opts ...clie } } + c.trackerWriteLock.Lock() + defer c.trackerWriteLock.Unlock() // Check the ResourceVersion if that Precondition was specified. if delOptions.Preconditions != nil && delOptions.Preconditions.ResourceVersion != nil { name := accessor.GetName() @@ -772,7 +789,7 @@ func (c *fakeClient) Delete(ctx context.Context, obj client.Object, opts ...clie } } - return c.deleteObject(gvr, accessor) + return c.deleteObjectLocked(gvr, accessor) } func (c *fakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { @@ -790,6 +807,9 @@ func (c *fakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts .. } } + c.trackerWriteLock.Lock() + defer c.trackerWriteLock.Unlock() + gvr, _ := meta.UnsafeGuessKindToResource(gvk) o, err := c.tracker.List(gvr, gvk, dcOptions.Namespace) if err != nil { @@ -809,7 +829,7 @@ func (c *fakeClient) DeleteAllOf(ctx context.Context, obj client.Object, opts .. if err != nil { return err } - err = c.deleteObject(gvr, accessor) + err = c.deleteObjectLocked(gvr, accessor) if err != nil { return err } @@ -839,6 +859,9 @@ func (c *fakeClient) update(obj client.Object, isStatus bool, opts ...client.Upd if err != nil { return err } + + c.trackerWriteLock.Lock() + defer c.trackerWriteLock.Unlock() return c.tracker.update(gvr, obj, accessor.GetNamespace(), isStatus, false, *updateOptions.AsUpdateOptions()) } @@ -874,6 +897,8 @@ func (c *fakeClient) patch(obj client.Object, patch client.Patch, opts ...client return err } + c.trackerWriteLock.Lock() + defer c.trackerWriteLock.Unlock() oldObj, err := c.tracker.Get(gvr, accessor.GetNamespace(), accessor.GetName()) if err != nil { return err @@ -1082,7 +1107,7 @@ func (c *fakeClient) SubResource(subResource string) client.SubResourceClient { return &fakeSubResourceClient{client: c, subResource: subResource} } -func (c *fakeClient) deleteObject(gvr schema.GroupVersionResource, accessor metav1.Object) error { +func (c *fakeClient) deleteObjectLocked(gvr schema.GroupVersionResource, accessor metav1.Object) error { old, err := c.tracker.Get(gvr, accessor.GetNamespace(), accessor.GetName()) if err == nil { oldAccessor, err := meta.Accessor(old) @@ -1164,7 +1189,7 @@ func (sw *fakeSubResourceClient) Update(ctx context.Context, obj client.Object, switch sw.subResource { case subResourceScale: - if err := sw.client.Get(ctx, client.ObjectKeyFromObject(obj), obj); err != nil { + if err := sw.client.Get(ctx, client.ObjectKeyFromObject(obj), obj.DeepCopyObject().(client.Object)); err != nil { return err } if updateOptions.SubResourceBody == nil { diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/allowedroutes.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/allowedroutes.go index 630e24ff2a..07702c8788 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/allowedroutes.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/allowedroutes.go @@ -18,14 +18,14 @@ limitations under the License. package v1 -// AllowedRoutesApplyConfiguration represents an declarative configuration of the AllowedRoutes type for use +// AllowedRoutesApplyConfiguration represents a declarative configuration of the AllowedRoutes type for use // with apply. type AllowedRoutesApplyConfiguration struct { Namespaces *RouteNamespacesApplyConfiguration `json:"namespaces,omitempty"` Kinds []RouteGroupKindApplyConfiguration `json:"kinds,omitempty"` } -// AllowedRoutesApplyConfiguration constructs an declarative configuration of the AllowedRoutes type for use with +// AllowedRoutesApplyConfiguration constructs a declarative configuration of the AllowedRoutes type for use with // apply. func AllowedRoutes() *AllowedRoutesApplyConfiguration { return &AllowedRoutesApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendobjectreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendobjectreference.go index 49487ef722..a8d9c663de 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendobjectreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendobjectreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// BackendObjectReferenceApplyConfiguration represents an declarative configuration of the BackendObjectReference type for use +// BackendObjectReferenceApplyConfiguration represents a declarative configuration of the BackendObjectReference type for use // with apply. type BackendObjectReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -32,7 +32,7 @@ type BackendObjectReferenceApplyConfiguration struct { Port *v1.PortNumber `json:"port,omitempty"` } -// BackendObjectReferenceApplyConfiguration constructs an declarative configuration of the BackendObjectReference type for use with +// BackendObjectReferenceApplyConfiguration constructs a declarative configuration of the BackendObjectReference type for use with // apply. func BackendObjectReference() *BackendObjectReferenceApplyConfiguration { return &BackendObjectReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendref.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendref.go index cbbc24c250..c30007dc86 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendref.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/backendref.go @@ -22,14 +22,14 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// BackendRefApplyConfiguration represents an declarative configuration of the BackendRef type for use +// BackendRefApplyConfiguration represents a declarative configuration of the BackendRef type for use // with apply. type BackendRefApplyConfiguration struct { BackendObjectReferenceApplyConfiguration `json:",inline"` Weight *int32 `json:"weight,omitempty"` } -// BackendRefApplyConfiguration constructs an declarative configuration of the BackendRef type for use with +// BackendRefApplyConfiguration constructs a declarative configuration of the BackendRef type for use with // apply. func BackendRef() *BackendRefApplyConfiguration { return &BackendRefApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/commonroutespec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/commonroutespec.go index faa727cceb..00dcfe71e2 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/commonroutespec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/commonroutespec.go @@ -18,13 +18,13 @@ limitations under the License. package v1 -// CommonRouteSpecApplyConfiguration represents an declarative configuration of the CommonRouteSpec type for use +// CommonRouteSpecApplyConfiguration represents a declarative configuration of the CommonRouteSpec type for use // with apply. type CommonRouteSpecApplyConfiguration struct { ParentRefs []ParentReferenceApplyConfiguration `json:"parentRefs,omitempty"` } -// CommonRouteSpecApplyConfiguration constructs an declarative configuration of the CommonRouteSpec type for use with +// CommonRouteSpecApplyConfiguration constructs a declarative configuration of the CommonRouteSpec type for use with // apply. func CommonRouteSpec() *CommonRouteSpecApplyConfiguration { return &CommonRouteSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/cookieconfig.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/cookieconfig.go index 7702c69a56..9280ddce51 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/cookieconfig.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/cookieconfig.go @@ -22,13 +22,13 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// CookieConfigApplyConfiguration represents an declarative configuration of the CookieConfig type for use +// CookieConfigApplyConfiguration represents a declarative configuration of the CookieConfig type for use // with apply. type CookieConfigApplyConfiguration struct { LifetimeType *v1.CookieLifetimeType `json:"lifetimeType,omitempty"` } -// CookieConfigApplyConfiguration constructs an declarative configuration of the CookieConfig type for use with +// CookieConfigApplyConfiguration constructs a declarative configuration of the CookieConfig type for use with // apply. func CookieConfig() *CookieConfigApplyConfiguration { return &CookieConfigApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/fraction.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/fraction.go new file mode 100644 index 0000000000..2c81976000 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/fraction.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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// FractionApplyConfiguration represents a declarative configuration of the Fraction type for use +// with apply. +type FractionApplyConfiguration struct { + Numerator *int32 `json:"numerator,omitempty"` + Denominator *int32 `json:"denominator,omitempty"` +} + +// FractionApplyConfiguration constructs a declarative configuration of the Fraction type for use with +// apply. +func Fraction() *FractionApplyConfiguration { + return &FractionApplyConfiguration{} +} + +// WithNumerator sets the Numerator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Numerator field is set to the value of the last call. +func (b *FractionApplyConfiguration) WithNumerator(value int32) *FractionApplyConfiguration { + b.Numerator = &value + return b +} + +// WithDenominator sets the Denominator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Denominator field is set to the value of the last call. +func (b *FractionApplyConfiguration) WithDenominator(value int32) *FractionApplyConfiguration { + b.Denominator = &value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/frontendtlsvalidation.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/frontendtlsvalidation.go index 7fafdf8cea..5342400ccf 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/frontendtlsvalidation.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/frontendtlsvalidation.go @@ -18,13 +18,13 @@ limitations under the License. package v1 -// FrontendTLSValidationApplyConfiguration represents an declarative configuration of the FrontendTLSValidation type for use +// FrontendTLSValidationApplyConfiguration represents a declarative configuration of the FrontendTLSValidation type for use // with apply. type FrontendTLSValidationApplyConfiguration struct { CACertificateRefs []ObjectReferenceApplyConfiguration `json:"caCertificateRefs,omitempty"` } -// FrontendTLSValidationApplyConfiguration constructs an declarative configuration of the FrontendTLSValidation type for use with +// FrontendTLSValidationApplyConfiguration constructs a declarative configuration of the FrontendTLSValidation type for use with // apply. func FrontendTLSValidation() *FrontendTLSValidationApplyConfiguration { return &FrontendTLSValidationApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gateway.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gateway.go index befe0daff9..8e8f27e6fb 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gateway.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gateway.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" gatewayapiapisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayApplyConfiguration represents an declarative configuration of the Gateway type for use +// GatewayApplyConfiguration represents a declarative configuration of the Gateway type for use // with apply. type GatewayApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type GatewayApplyConfiguration struct { Status *GatewayStatusApplyConfiguration `json:"status,omitempty"` } -// Gateway constructs an declarative configuration of the Gateway type for use with +// Gateway constructs a declarative configuration of the Gateway type for use with // apply. func Gateway(name, namespace string) *GatewayApplyConfiguration { b := &GatewayApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *GatewayApplyConfiguration) WithStatus(value *GatewayStatusApplyConfigur b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *GatewayApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayaddress.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayaddress.go index e810a109d8..28821a7a01 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayaddress.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayaddress.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayAddressApplyConfiguration represents an declarative configuration of the GatewayAddress type for use +// GatewayAddressApplyConfiguration represents a declarative configuration of the GatewayAddress type for use // with apply. type GatewayAddressApplyConfiguration struct { Type *v1.AddressType `json:"type,omitempty"` Value *string `json:"value,omitempty"` } -// GatewayAddressApplyConfiguration constructs an declarative configuration of the GatewayAddress type for use with +// GatewayAddressApplyConfiguration constructs a declarative configuration of the GatewayAddress type for use with // apply. func GatewayAddress() *GatewayAddressApplyConfiguration { return &GatewayAddressApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaybackendtls.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaybackendtls.go new file mode 100644 index 0000000000..eee2550713 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaybackendtls.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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// GatewayBackendTLSApplyConfiguration represents a declarative configuration of the GatewayBackendTLS type for use +// with apply. +type GatewayBackendTLSApplyConfiguration struct { + ClientCertificateRef *SecretObjectReferenceApplyConfiguration `json:"clientCertificateRef,omitempty"` +} + +// GatewayBackendTLSApplyConfiguration constructs a declarative configuration of the GatewayBackendTLS type for use with +// apply. +func GatewayBackendTLS() *GatewayBackendTLSApplyConfiguration { + return &GatewayBackendTLSApplyConfiguration{} +} + +// WithClientCertificateRef sets the ClientCertificateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientCertificateRef field is set to the value of the last call. +func (b *GatewayBackendTLSApplyConfiguration) WithClientCertificateRef(value *SecretObjectReferenceApplyConfiguration) *GatewayBackendTLSApplyConfiguration { + b.ClientCertificateRef = value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclass.go index 63ff9600e7..7d1cfcbc5f 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclass.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclass.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" gatewayapiapisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayClassApplyConfiguration represents an declarative configuration of the GatewayClass type for use +// GatewayClassApplyConfiguration represents a declarative configuration of the GatewayClass type for use // with apply. type GatewayClassApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type GatewayClassApplyConfiguration struct { Status *GatewayClassStatusApplyConfiguration `json:"status,omitempty"` } -// GatewayClass constructs an declarative configuration of the GatewayClass type for use with +// GatewayClass constructs a declarative configuration of the GatewayClass type for use with // apply. func GatewayClass(name string) *GatewayClassApplyConfiguration { b := &GatewayClassApplyConfiguration{} @@ -255,3 +254,9 @@ func (b *GatewayClassApplyConfiguration) WithStatus(value *GatewayClassStatusApp b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *GatewayClassApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassspec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassspec.go index 460724ff72..8591cd2138 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassspec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassspec.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayClassSpecApplyConfiguration represents an declarative configuration of the GatewayClassSpec type for use +// GatewayClassSpecApplyConfiguration represents a declarative configuration of the GatewayClassSpec type for use // with apply. type GatewayClassSpecApplyConfiguration struct { ControllerName *v1.GatewayController `json:"controllerName,omitempty"` @@ -30,7 +30,7 @@ type GatewayClassSpecApplyConfiguration struct { Description *string `json:"description,omitempty"` } -// GatewayClassSpecApplyConfiguration constructs an declarative configuration of the GatewayClassSpec type for use with +// GatewayClassSpecApplyConfiguration constructs a declarative configuration of the GatewayClassSpec type for use with // apply. func GatewayClassSpec() *GatewayClassSpecApplyConfiguration { return &GatewayClassSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassstatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassstatus.go index ba5a583179..fb3fa8df15 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassstatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayclassstatus.go @@ -20,17 +20,16 @@ package v1 import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" - apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayClassStatusApplyConfiguration represents an declarative configuration of the GatewayClassStatus type for use +// GatewayClassStatusApplyConfiguration represents a declarative configuration of the GatewayClassStatus type for use // with apply. type GatewayClassStatusApplyConfiguration struct { - Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` - SupportedFeatures []apisv1.SupportedFeature `json:"supportedFeatures,omitempty"` + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + SupportedFeatures []SupportedFeatureApplyConfiguration `json:"supportedFeatures,omitempty"` } -// GatewayClassStatusApplyConfiguration constructs an declarative configuration of the GatewayClassStatus type for use with +// GatewayClassStatusApplyConfiguration constructs a declarative configuration of the GatewayClassStatus type for use with // apply. func GatewayClassStatus() *GatewayClassStatusApplyConfiguration { return &GatewayClassStatusApplyConfiguration{} @@ -52,9 +51,12 @@ func (b *GatewayClassStatusApplyConfiguration) WithConditions(values ...*v1.Cond // WithSupportedFeatures adds the given value to the SupportedFeatures field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the SupportedFeatures field. -func (b *GatewayClassStatusApplyConfiguration) WithSupportedFeatures(values ...apisv1.SupportedFeature) *GatewayClassStatusApplyConfiguration { +func (b *GatewayClassStatusApplyConfiguration) WithSupportedFeatures(values ...*SupportedFeatureApplyConfiguration) *GatewayClassStatusApplyConfiguration { for i := range values { - b.SupportedFeatures = append(b.SupportedFeatures, values[i]) + if values[i] == nil { + panic("nil value passed to WithSupportedFeatures") + } + b.SupportedFeatures = append(b.SupportedFeatures, *values[i]) } return b } diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayinfrastructure.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayinfrastructure.go index 43ca7e63e0..0bed1ad25c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayinfrastructure.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayinfrastructure.go @@ -22,15 +22,15 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayInfrastructureApplyConfiguration represents an declarative configuration of the GatewayInfrastructure type for use +// GatewayInfrastructureApplyConfiguration represents a declarative configuration of the GatewayInfrastructure type for use // with apply. type GatewayInfrastructureApplyConfiguration struct { - Labels map[v1.AnnotationKey]v1.AnnotationValue `json:"labels,omitempty"` + Labels map[v1.LabelKey]v1.LabelValue `json:"labels,omitempty"` Annotations map[v1.AnnotationKey]v1.AnnotationValue `json:"annotations,omitempty"` ParametersRef *LocalParametersReferenceApplyConfiguration `json:"parametersRef,omitempty"` } -// GatewayInfrastructureApplyConfiguration constructs an declarative configuration of the GatewayInfrastructure type for use with +// GatewayInfrastructureApplyConfiguration constructs a declarative configuration of the GatewayInfrastructure type for use with // apply. func GatewayInfrastructure() *GatewayInfrastructureApplyConfiguration { return &GatewayInfrastructureApplyConfiguration{} @@ -40,9 +40,9 @@ func GatewayInfrastructure() *GatewayInfrastructureApplyConfiguration { // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Labels field, // overwriting an existing map entries in Labels field with the same key. -func (b *GatewayInfrastructureApplyConfiguration) WithLabels(entries map[v1.AnnotationKey]v1.AnnotationValue) *GatewayInfrastructureApplyConfiguration { +func (b *GatewayInfrastructureApplyConfiguration) WithLabels(entries map[v1.LabelKey]v1.LabelValue) *GatewayInfrastructureApplyConfiguration { if b.Labels == nil && len(entries) > 0 { - b.Labels = make(map[v1.AnnotationKey]v1.AnnotationValue, len(entries)) + b.Labels = make(map[v1.LabelKey]v1.LabelValue, len(entries)) } for k, v := range entries { b.Labels[k] = v diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayspec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayspec.go index a3f935f651..89ff6b48b5 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayspec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewayspec.go @@ -22,16 +22,17 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewaySpecApplyConfiguration represents an declarative configuration of the GatewaySpec type for use +// GatewaySpecApplyConfiguration represents a declarative configuration of the GatewaySpec type for use // with apply. type GatewaySpecApplyConfiguration struct { GatewayClassName *v1.ObjectName `json:"gatewayClassName,omitempty"` Listeners []ListenerApplyConfiguration `json:"listeners,omitempty"` Addresses []GatewayAddressApplyConfiguration `json:"addresses,omitempty"` Infrastructure *GatewayInfrastructureApplyConfiguration `json:"infrastructure,omitempty"` + BackendTLS *GatewayBackendTLSApplyConfiguration `json:"backendTLS,omitempty"` } -// GatewaySpecApplyConfiguration constructs an declarative configuration of the GatewaySpec type for use with +// GatewaySpecApplyConfiguration constructs a declarative configuration of the GatewaySpec type for use with // apply. func GatewaySpec() *GatewaySpecApplyConfiguration { return &GatewaySpecApplyConfiguration{} @@ -78,3 +79,11 @@ func (b *GatewaySpecApplyConfiguration) WithInfrastructure(value *GatewayInfrast b.Infrastructure = value return b } + +// WithBackendTLS sets the BackendTLS field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BackendTLS field is set to the value of the last call. +func (b *GatewaySpecApplyConfiguration) WithBackendTLS(value *GatewayBackendTLSApplyConfiguration) *GatewaySpecApplyConfiguration { + b.BackendTLS = value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatus.go index 3bb277d608..3e96cd2907 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatus.go @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// GatewayStatusApplyConfiguration represents an declarative configuration of the GatewayStatus type for use +// GatewayStatusApplyConfiguration represents a declarative configuration of the GatewayStatus type for use // with apply. type GatewayStatusApplyConfiguration struct { Addresses []GatewayStatusAddressApplyConfiguration `json:"addresses,omitempty"` @@ -30,7 +30,7 @@ type GatewayStatusApplyConfiguration struct { Listeners []ListenerStatusApplyConfiguration `json:"listeners,omitempty"` } -// GatewayStatusApplyConfiguration constructs an declarative configuration of the GatewayStatus type for use with +// GatewayStatusApplyConfiguration constructs a declarative configuration of the GatewayStatus type for use with // apply. func GatewayStatus() *GatewayStatusApplyConfiguration { return &GatewayStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatusaddress.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatusaddress.go index b21251e107..a40b54415a 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatusaddress.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaystatusaddress.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayStatusAddressApplyConfiguration represents an declarative configuration of the GatewayStatusAddress type for use +// GatewayStatusAddressApplyConfiguration represents a declarative configuration of the GatewayStatusAddress type for use // with apply. type GatewayStatusAddressApplyConfiguration struct { Type *v1.AddressType `json:"type,omitempty"` Value *string `json:"value,omitempty"` } -// GatewayStatusAddressApplyConfiguration constructs an declarative configuration of the GatewayStatusAddress type for use with +// GatewayStatusAddressApplyConfiguration constructs a declarative configuration of the GatewayStatusAddress type for use with // apply. func GatewayStatusAddress() *GatewayStatusAddressApplyConfiguration { return &GatewayStatusAddressApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaytlsconfig.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaytlsconfig.go index 7062430197..57c76b2e89 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaytlsconfig.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/gatewaytlsconfig.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GatewayTLSConfigApplyConfiguration represents an declarative configuration of the GatewayTLSConfig type for use +// GatewayTLSConfigApplyConfiguration represents a declarative configuration of the GatewayTLSConfig type for use // with apply. type GatewayTLSConfigApplyConfiguration struct { Mode *v1.TLSModeType `json:"mode,omitempty"` @@ -31,7 +31,7 @@ type GatewayTLSConfigApplyConfiguration struct { Options map[v1.AnnotationKey]v1.AnnotationValue `json:"options,omitempty"` } -// GatewayTLSConfigApplyConfiguration constructs an declarative configuration of the GatewayTLSConfig type for use with +// GatewayTLSConfigApplyConfiguration constructs a declarative configuration of the GatewayTLSConfig type for use with // apply. func GatewayTLSConfig() *GatewayTLSConfigApplyConfiguration { return &GatewayTLSConfigApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcbackendref.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcbackendref.go index d3d457bb65..ed8bd4edec 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcbackendref.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcbackendref.go @@ -22,14 +22,14 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GRPCBackendRefApplyConfiguration represents an declarative configuration of the GRPCBackendRef type for use +// GRPCBackendRefApplyConfiguration represents a declarative configuration of the GRPCBackendRef type for use // with apply. type GRPCBackendRefApplyConfiguration struct { BackendRefApplyConfiguration `json:",inline"` Filters []GRPCRouteFilterApplyConfiguration `json:"filters,omitempty"` } -// GRPCBackendRefApplyConfiguration constructs an declarative configuration of the GRPCBackendRef type for use with +// GRPCBackendRefApplyConfiguration constructs a declarative configuration of the GRPCBackendRef type for use with // apply. func GRPCBackendRef() *GRPCBackendRefApplyConfiguration { return &GRPCBackendRefApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcheadermatch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcheadermatch.go index 16b6ee4dcc..868f404874 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcheadermatch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcheadermatch.go @@ -22,15 +22,15 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GRPCHeaderMatchApplyConfiguration represents an declarative configuration of the GRPCHeaderMatch type for use +// GRPCHeaderMatchApplyConfiguration represents a declarative configuration of the GRPCHeaderMatch type for use // with apply. type GRPCHeaderMatchApplyConfiguration struct { - Type *v1.HeaderMatchType `json:"type,omitempty"` - Name *v1.GRPCHeaderName `json:"name,omitempty"` - Value *string `json:"value,omitempty"` + Type *v1.GRPCHeaderMatchType `json:"type,omitempty"` + Name *v1.GRPCHeaderName `json:"name,omitempty"` + Value *string `json:"value,omitempty"` } -// GRPCHeaderMatchApplyConfiguration constructs an declarative configuration of the GRPCHeaderMatch type for use with +// GRPCHeaderMatchApplyConfiguration constructs a declarative configuration of the GRPCHeaderMatch type for use with // apply. func GRPCHeaderMatch() *GRPCHeaderMatchApplyConfiguration { return &GRPCHeaderMatchApplyConfiguration{} @@ -39,7 +39,7 @@ func GRPCHeaderMatch() *GRPCHeaderMatchApplyConfiguration { // WithType sets the Type field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Type field is set to the value of the last call. -func (b *GRPCHeaderMatchApplyConfiguration) WithType(value v1.HeaderMatchType) *GRPCHeaderMatchApplyConfiguration { +func (b *GRPCHeaderMatchApplyConfiguration) WithType(value v1.GRPCHeaderMatchType) *GRPCHeaderMatchApplyConfiguration { b.Type = &value return b } diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcmethodmatch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcmethodmatch.go index 7eefe9beb2..26e0804506 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcmethodmatch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcmethodmatch.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GRPCMethodMatchApplyConfiguration represents an declarative configuration of the GRPCMethodMatch type for use +// GRPCMethodMatchApplyConfiguration represents a declarative configuration of the GRPCMethodMatch type for use // with apply. type GRPCMethodMatchApplyConfiguration struct { Type *v1.GRPCMethodMatchType `json:"type,omitempty"` @@ -30,7 +30,7 @@ type GRPCMethodMatchApplyConfiguration struct { Method *string `json:"method,omitempty"` } -// GRPCMethodMatchApplyConfiguration constructs an declarative configuration of the GRPCMethodMatch type for use with +// GRPCMethodMatchApplyConfiguration constructs a declarative configuration of the GRPCMethodMatch type for use with // apply. func GRPCMethodMatch() *GRPCMethodMatchApplyConfiguration { return &GRPCMethodMatchApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroute.go index f44879a857..3c3b376dbf 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroute.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" gatewayapiapisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GRPCRouteApplyConfiguration represents an declarative configuration of the GRPCRoute type for use +// GRPCRouteApplyConfiguration represents a declarative configuration of the GRPCRoute type for use // with apply. type GRPCRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type GRPCRouteApplyConfiguration struct { Status *GRPCRouteStatusApplyConfiguration `json:"status,omitempty"` } -// GRPCRoute constructs an declarative configuration of the GRPCRoute type for use with +// GRPCRoute constructs a declarative configuration of the GRPCRoute type for use with // apply. func GRPCRoute(name, namespace string) *GRPCRouteApplyConfiguration { b := &GRPCRouteApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *GRPCRouteApplyConfiguration) WithStatus(value *GRPCRouteStatusApplyConf b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *GRPCRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutefilter.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutefilter.go index f7292af6d3..80f94c947e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutefilter.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutefilter.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GRPCRouteFilterApplyConfiguration represents an declarative configuration of the GRPCRouteFilter type for use +// GRPCRouteFilterApplyConfiguration represents a declarative configuration of the GRPCRouteFilter type for use // with apply. type GRPCRouteFilterApplyConfiguration struct { Type *v1.GRPCRouteFilterType `json:"type,omitempty"` @@ -32,7 +32,7 @@ type GRPCRouteFilterApplyConfiguration struct { ExtensionRef *LocalObjectReferenceApplyConfiguration `json:"extensionRef,omitempty"` } -// GRPCRouteFilterApplyConfiguration constructs an declarative configuration of the GRPCRouteFilter type for use with +// GRPCRouteFilterApplyConfiguration constructs a declarative configuration of the GRPCRouteFilter type for use with // apply. func GRPCRouteFilter() *GRPCRouteFilterApplyConfiguration { return &GRPCRouteFilterApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutematch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutematch.go index cddaef383b..1c068fd5c7 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutematch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutematch.go @@ -18,14 +18,14 @@ limitations under the License. package v1 -// GRPCRouteMatchApplyConfiguration represents an declarative configuration of the GRPCRouteMatch type for use +// GRPCRouteMatchApplyConfiguration represents a declarative configuration of the GRPCRouteMatch type for use // with apply. type GRPCRouteMatchApplyConfiguration struct { Method *GRPCMethodMatchApplyConfiguration `json:"method,omitempty"` Headers []GRPCHeaderMatchApplyConfiguration `json:"headers,omitempty"` } -// GRPCRouteMatchApplyConfiguration constructs an declarative configuration of the GRPCRouteMatch type for use with +// GRPCRouteMatchApplyConfiguration constructs a declarative configuration of the GRPCRouteMatch type for use with // apply. func GRPCRouteMatch() *GRPCRouteMatchApplyConfiguration { return &GRPCRouteMatchApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcrouterule.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcrouterule.go index 367fe37260..447a9ccc2e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcrouterule.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcrouterule.go @@ -18,21 +18,34 @@ limitations under the License. package v1 -// GRPCRouteRuleApplyConfiguration represents an declarative configuration of the GRPCRouteRule type for use +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// GRPCRouteRuleApplyConfiguration represents a declarative configuration of the GRPCRouteRule type for use // with apply. type GRPCRouteRuleApplyConfiguration struct { + Name *v1.SectionName `json:"name,omitempty"` Matches []GRPCRouteMatchApplyConfiguration `json:"matches,omitempty"` Filters []GRPCRouteFilterApplyConfiguration `json:"filters,omitempty"` BackendRefs []GRPCBackendRefApplyConfiguration `json:"backendRefs,omitempty"` SessionPersistence *SessionPersistenceApplyConfiguration `json:"sessionPersistence,omitempty"` } -// GRPCRouteRuleApplyConfiguration constructs an declarative configuration of the GRPCRouteRule type for use with +// GRPCRouteRuleApplyConfiguration constructs a declarative configuration of the GRPCRouteRule type for use with // apply. func GRPCRouteRule() *GRPCRouteRuleApplyConfiguration { return &GRPCRouteRuleApplyConfiguration{} } +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *GRPCRouteRuleApplyConfiguration) WithName(value v1.SectionName) *GRPCRouteRuleApplyConfiguration { + b.Name = &value + return b +} + // WithMatches adds the given value to the Matches field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Matches field. diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutespec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutespec.go index 666f502d1f..70c1e63741 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutespec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutespec.go @@ -22,7 +22,7 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// GRPCRouteSpecApplyConfiguration represents an declarative configuration of the GRPCRouteSpec type for use +// GRPCRouteSpecApplyConfiguration represents a declarative configuration of the GRPCRouteSpec type for use // with apply. type GRPCRouteSpecApplyConfiguration struct { CommonRouteSpecApplyConfiguration `json:",inline"` @@ -30,7 +30,7 @@ type GRPCRouteSpecApplyConfiguration struct { Rules []GRPCRouteRuleApplyConfiguration `json:"rules,omitempty"` } -// GRPCRouteSpecApplyConfiguration constructs an declarative configuration of the GRPCRouteSpec type for use with +// GRPCRouteSpecApplyConfiguration constructs a declarative configuration of the GRPCRouteSpec type for use with // apply. func GRPCRouteSpec() *GRPCRouteSpecApplyConfiguration { return &GRPCRouteSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutestatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutestatus.go index 3a5473b8b0..3ed9c24801 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutestatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/grpcroutestatus.go @@ -18,13 +18,13 @@ limitations under the License. package v1 -// GRPCRouteStatusApplyConfiguration represents an declarative configuration of the GRPCRouteStatus type for use +// GRPCRouteStatusApplyConfiguration represents a declarative configuration of the GRPCRouteStatus type for use // with apply. type GRPCRouteStatusApplyConfiguration struct { RouteStatusApplyConfiguration `json:",inline"` } -// GRPCRouteStatusApplyConfiguration constructs an declarative configuration of the GRPCRouteStatus type for use with +// GRPCRouteStatusApplyConfiguration constructs a declarative configuration of the GRPCRouteStatus type for use with // apply. func GRPCRouteStatus() *GRPCRouteStatusApplyConfiguration { return &GRPCRouteStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpbackendref.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpbackendref.go index 4041d9bc66..3110537f60 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpbackendref.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpbackendref.go @@ -22,14 +22,14 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPBackendRefApplyConfiguration represents an declarative configuration of the HTTPBackendRef type for use +// HTTPBackendRefApplyConfiguration represents a declarative configuration of the HTTPBackendRef type for use // with apply. type HTTPBackendRefApplyConfiguration struct { BackendRefApplyConfiguration `json:",inline"` Filters []HTTPRouteFilterApplyConfiguration `json:"filters,omitempty"` } -// HTTPBackendRefApplyConfiguration constructs an declarative configuration of the HTTPBackendRef type for use with +// HTTPBackendRefApplyConfiguration constructs a declarative configuration of the HTTPBackendRef type for use with // apply. func HTTPBackendRef() *HTTPBackendRefApplyConfiguration { return &HTTPBackendRefApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheader.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheader.go index a1c9cc915e..9a4bfc8b32 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheader.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheader.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPHeaderApplyConfiguration represents an declarative configuration of the HTTPHeader type for use +// HTTPHeaderApplyConfiguration represents a declarative configuration of the HTTPHeader type for use // with apply. type HTTPHeaderApplyConfiguration struct { Name *v1.HTTPHeaderName `json:"name,omitempty"` Value *string `json:"value,omitempty"` } -// HTTPHeaderApplyConfiguration constructs an declarative configuration of the HTTPHeader type for use with +// HTTPHeaderApplyConfiguration constructs a declarative configuration of the HTTPHeader type for use with // apply. func HTTPHeader() *HTTPHeaderApplyConfiguration { return &HTTPHeaderApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheaderfilter.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheaderfilter.go index f6cc5f24c3..45db46ccca 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheaderfilter.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheaderfilter.go @@ -18,7 +18,7 @@ limitations under the License. package v1 -// HTTPHeaderFilterApplyConfiguration represents an declarative configuration of the HTTPHeaderFilter type for use +// HTTPHeaderFilterApplyConfiguration represents a declarative configuration of the HTTPHeaderFilter type for use // with apply. type HTTPHeaderFilterApplyConfiguration struct { Set []HTTPHeaderApplyConfiguration `json:"set,omitempty"` @@ -26,7 +26,7 @@ type HTTPHeaderFilterApplyConfiguration struct { Remove []string `json:"remove,omitempty"` } -// HTTPHeaderFilterApplyConfiguration constructs an declarative configuration of the HTTPHeaderFilter type for use with +// HTTPHeaderFilterApplyConfiguration constructs a declarative configuration of the HTTPHeaderFilter type for use with // apply. func HTTPHeaderFilter() *HTTPHeaderFilterApplyConfiguration { return &HTTPHeaderFilterApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheadermatch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheadermatch.go index 96abbb4f19..e2ce954a23 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheadermatch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpheadermatch.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPHeaderMatchApplyConfiguration represents an declarative configuration of the HTTPHeaderMatch type for use +// HTTPHeaderMatchApplyConfiguration represents a declarative configuration of the HTTPHeaderMatch type for use // with apply. type HTTPHeaderMatchApplyConfiguration struct { Type *v1.HeaderMatchType `json:"type,omitempty"` @@ -30,7 +30,7 @@ type HTTPHeaderMatchApplyConfiguration struct { Value *string `json:"value,omitempty"` } -// HTTPHeaderMatchApplyConfiguration constructs an declarative configuration of the HTTPHeaderMatch type for use with +// HTTPHeaderMatchApplyConfiguration constructs a declarative configuration of the HTTPHeaderMatch type for use with // apply. func HTTPHeaderMatch() *HTTPHeaderMatchApplyConfiguration { return &HTTPHeaderMatchApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmatch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmatch.go index 985121b31b..ca21e6dfcc 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmatch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmatch.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPPathMatchApplyConfiguration represents an declarative configuration of the HTTPPathMatch type for use +// HTTPPathMatchApplyConfiguration represents a declarative configuration of the HTTPPathMatch type for use // with apply. type HTTPPathMatchApplyConfiguration struct { Type *v1.PathMatchType `json:"type,omitempty"` Value *string `json:"value,omitempty"` } -// HTTPPathMatchApplyConfiguration constructs an declarative configuration of the HTTPPathMatch type for use with +// HTTPPathMatchApplyConfiguration constructs a declarative configuration of the HTTPPathMatch type for use with // apply. func HTTPPathMatch() *HTTPPathMatchApplyConfiguration { return &HTTPPathMatchApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmodifier.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmodifier.go index e675cadb0e..888f3c7f1f 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmodifier.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httppathmodifier.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPPathModifierApplyConfiguration represents an declarative configuration of the HTTPPathModifier type for use +// HTTPPathModifierApplyConfiguration represents a declarative configuration of the HTTPPathModifier type for use // with apply. type HTTPPathModifierApplyConfiguration struct { Type *v1.HTTPPathModifierType `json:"type,omitempty"` @@ -30,7 +30,7 @@ type HTTPPathModifierApplyConfiguration struct { ReplacePrefixMatch *string `json:"replacePrefixMatch,omitempty"` } -// HTTPPathModifierApplyConfiguration constructs an declarative configuration of the HTTPPathModifier type for use with +// HTTPPathModifierApplyConfiguration constructs a declarative configuration of the HTTPPathModifier type for use with // apply. func HTTPPathModifier() *HTTPPathModifierApplyConfiguration { return &HTTPPathModifierApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpqueryparammatch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpqueryparammatch.go index 3bc97e21b9..ccbdfe941f 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpqueryparammatch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpqueryparammatch.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPQueryParamMatchApplyConfiguration represents an declarative configuration of the HTTPQueryParamMatch type for use +// HTTPQueryParamMatchApplyConfiguration represents a declarative configuration of the HTTPQueryParamMatch type for use // with apply. type HTTPQueryParamMatchApplyConfiguration struct { Type *v1.QueryParamMatchType `json:"type,omitempty"` @@ -30,7 +30,7 @@ type HTTPQueryParamMatchApplyConfiguration struct { Value *string `json:"value,omitempty"` } -// HTTPQueryParamMatchApplyConfiguration constructs an declarative configuration of the HTTPQueryParamMatch type for use with +// HTTPQueryParamMatchApplyConfiguration constructs a declarative configuration of the HTTPQueryParamMatch type for use with // apply. func HTTPQueryParamMatch() *HTTPQueryParamMatchApplyConfiguration { return &HTTPQueryParamMatchApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestmirrorfilter.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestmirrorfilter.go index 1809ff078a..1885cccda0 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestmirrorfilter.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestmirrorfilter.go @@ -18,13 +18,15 @@ limitations under the License. package v1 -// HTTPRequestMirrorFilterApplyConfiguration represents an declarative configuration of the HTTPRequestMirrorFilter type for use +// HTTPRequestMirrorFilterApplyConfiguration represents a declarative configuration of the HTTPRequestMirrorFilter type for use // with apply. type HTTPRequestMirrorFilterApplyConfiguration struct { BackendRef *BackendObjectReferenceApplyConfiguration `json:"backendRef,omitempty"` + Percent *int32 `json:"percent,omitempty"` + Fraction *FractionApplyConfiguration `json:"fraction,omitempty"` } -// HTTPRequestMirrorFilterApplyConfiguration constructs an declarative configuration of the HTTPRequestMirrorFilter type for use with +// HTTPRequestMirrorFilterApplyConfiguration constructs a declarative configuration of the HTTPRequestMirrorFilter type for use with // apply. func HTTPRequestMirrorFilter() *HTTPRequestMirrorFilterApplyConfiguration { return &HTTPRequestMirrorFilterApplyConfiguration{} @@ -37,3 +39,19 @@ func (b *HTTPRequestMirrorFilterApplyConfiguration) WithBackendRef(value *Backen b.BackendRef = value return b } + +// WithPercent sets the Percent field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Percent field is set to the value of the last call. +func (b *HTTPRequestMirrorFilterApplyConfiguration) WithPercent(value int32) *HTTPRequestMirrorFilterApplyConfiguration { + b.Percent = &value + return b +} + +// WithFraction sets the Fraction field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Fraction field is set to the value of the last call. +func (b *HTTPRequestMirrorFilterApplyConfiguration) WithFraction(value *FractionApplyConfiguration) *HTTPRequestMirrorFilterApplyConfiguration { + b.Fraction = value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestredirectfilter.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestredirectfilter.go index c4a08c60ce..3a0c860070 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestredirectfilter.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprequestredirectfilter.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPRequestRedirectFilterApplyConfiguration represents an declarative configuration of the HTTPRequestRedirectFilter type for use +// HTTPRequestRedirectFilterApplyConfiguration represents a declarative configuration of the HTTPRequestRedirectFilter type for use // with apply. type HTTPRequestRedirectFilterApplyConfiguration struct { Scheme *string `json:"scheme,omitempty"` @@ -32,7 +32,7 @@ type HTTPRequestRedirectFilterApplyConfiguration struct { StatusCode *int `json:"statusCode,omitempty"` } -// HTTPRequestRedirectFilterApplyConfiguration constructs an declarative configuration of the HTTPRequestRedirectFilter type for use with +// HTTPRequestRedirectFilterApplyConfiguration constructs a declarative configuration of the HTTPRequestRedirectFilter type for use with // apply. func HTTPRequestRedirectFilter() *HTTPRequestRedirectFilterApplyConfiguration { return &HTTPRequestRedirectFilterApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproute.go index 26d94544a4..0fabf88cda 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproute.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" gatewayapiapisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPRouteApplyConfiguration represents an declarative configuration of the HTTPRoute type for use +// HTTPRouteApplyConfiguration represents a declarative configuration of the HTTPRoute type for use // with apply. type HTTPRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type HTTPRouteApplyConfiguration struct { Status *HTTPRouteStatusApplyConfiguration `json:"status,omitempty"` } -// HTTPRoute constructs an declarative configuration of the HTTPRoute type for use with +// HTTPRoute constructs a declarative configuration of the HTTPRoute type for use with // apply. func HTTPRoute(name, namespace string) *HTTPRouteApplyConfiguration { b := &HTTPRouteApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *HTTPRouteApplyConfiguration) WithStatus(value *HTTPRouteStatusApplyConf b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *HTTPRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutefilter.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutefilter.go index 9943ebd43b..a1c9b2e604 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutefilter.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutefilter.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPRouteFilterApplyConfiguration represents an declarative configuration of the HTTPRouteFilter type for use +// HTTPRouteFilterApplyConfiguration represents a declarative configuration of the HTTPRouteFilter type for use // with apply. type HTTPRouteFilterApplyConfiguration struct { Type *v1.HTTPRouteFilterType `json:"type,omitempty"` @@ -34,7 +34,7 @@ type HTTPRouteFilterApplyConfiguration struct { ExtensionRef *LocalObjectReferenceApplyConfiguration `json:"extensionRef,omitempty"` } -// HTTPRouteFilterApplyConfiguration constructs an declarative configuration of the HTTPRouteFilter type for use with +// HTTPRouteFilterApplyConfiguration constructs a declarative configuration of the HTTPRouteFilter type for use with // apply. func HTTPRouteFilter() *HTTPRouteFilterApplyConfiguration { return &HTTPRouteFilterApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutematch.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutematch.go index cfc1e0fbe0..c1d34d121a 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutematch.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutematch.go @@ -22,7 +22,7 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPRouteMatchApplyConfiguration represents an declarative configuration of the HTTPRouteMatch type for use +// HTTPRouteMatchApplyConfiguration represents a declarative configuration of the HTTPRouteMatch type for use // with apply. type HTTPRouteMatchApplyConfiguration struct { Path *HTTPPathMatchApplyConfiguration `json:"path,omitempty"` @@ -31,7 +31,7 @@ type HTTPRouteMatchApplyConfiguration struct { Method *apisv1.HTTPMethod `json:"method,omitempty"` } -// HTTPRouteMatchApplyConfiguration constructs an declarative configuration of the HTTPRouteMatch type for use with +// HTTPRouteMatchApplyConfiguration constructs a declarative configuration of the HTTPRouteMatch type for use with // apply. func HTTPRouteMatch() *HTTPRouteMatchApplyConfiguration { return &HTTPRouteMatchApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouteretry.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouteretry.go new file mode 100644 index 0000000000..7528bccee8 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouteretry.go @@ -0,0 +1,63 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// HTTPRouteRetryApplyConfiguration represents a declarative configuration of the HTTPRouteRetry type for use +// with apply. +type HTTPRouteRetryApplyConfiguration struct { + Codes []v1.HTTPRouteRetryStatusCode `json:"codes,omitempty"` + Attempts *int `json:"attempts,omitempty"` + Backoff *v1.Duration `json:"backoff,omitempty"` +} + +// HTTPRouteRetryApplyConfiguration constructs a declarative configuration of the HTTPRouteRetry type for use with +// apply. +func HTTPRouteRetry() *HTTPRouteRetryApplyConfiguration { + return &HTTPRouteRetryApplyConfiguration{} +} + +// WithCodes adds the given value to the Codes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Codes field. +func (b *HTTPRouteRetryApplyConfiguration) WithCodes(values ...v1.HTTPRouteRetryStatusCode) *HTTPRouteRetryApplyConfiguration { + for i := range values { + b.Codes = append(b.Codes, values[i]) + } + return b +} + +// WithAttempts sets the Attempts field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Attempts field is set to the value of the last call. +func (b *HTTPRouteRetryApplyConfiguration) WithAttempts(value int) *HTTPRouteRetryApplyConfiguration { + b.Attempts = &value + return b +} + +// WithBackoff sets the Backoff field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Backoff field is set to the value of the last call. +func (b *HTTPRouteRetryApplyConfiguration) WithBackoff(value v1.Duration) *HTTPRouteRetryApplyConfiguration { + b.Backoff = &value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouterule.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouterule.go index dcef6b12e2..b7ac89a7a8 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouterule.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httprouterule.go @@ -18,22 +18,36 @@ limitations under the License. package v1 -// HTTPRouteRuleApplyConfiguration represents an declarative configuration of the HTTPRouteRule type for use +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// HTTPRouteRuleApplyConfiguration represents a declarative configuration of the HTTPRouteRule type for use // with apply. type HTTPRouteRuleApplyConfiguration struct { + Name *v1.SectionName `json:"name,omitempty"` Matches []HTTPRouteMatchApplyConfiguration `json:"matches,omitempty"` Filters []HTTPRouteFilterApplyConfiguration `json:"filters,omitempty"` BackendRefs []HTTPBackendRefApplyConfiguration `json:"backendRefs,omitempty"` Timeouts *HTTPRouteTimeoutsApplyConfiguration `json:"timeouts,omitempty"` + Retry *HTTPRouteRetryApplyConfiguration `json:"retry,omitempty"` SessionPersistence *SessionPersistenceApplyConfiguration `json:"sessionPersistence,omitempty"` } -// HTTPRouteRuleApplyConfiguration constructs an declarative configuration of the HTTPRouteRule type for use with +// HTTPRouteRuleApplyConfiguration constructs a declarative configuration of the HTTPRouteRule type for use with // apply. func HTTPRouteRule() *HTTPRouteRuleApplyConfiguration { return &HTTPRouteRuleApplyConfiguration{} } +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *HTTPRouteRuleApplyConfiguration) WithName(value v1.SectionName) *HTTPRouteRuleApplyConfiguration { + b.Name = &value + return b +} + // WithMatches adds the given value to the Matches field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Matches field. @@ -81,6 +95,14 @@ func (b *HTTPRouteRuleApplyConfiguration) WithTimeouts(value *HTTPRouteTimeoutsA return b } +// WithRetry sets the Retry field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Retry field is set to the value of the last call. +func (b *HTTPRouteRuleApplyConfiguration) WithRetry(value *HTTPRouteRetryApplyConfiguration) *HTTPRouteRuleApplyConfiguration { + b.Retry = value + return b +} + // WithSessionPersistence sets the SessionPersistence field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the SessionPersistence field is set to the value of the last call. diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutespec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutespec.go index 21c9dfd86d..e12516149a 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutespec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutespec.go @@ -22,7 +22,7 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPRouteSpecApplyConfiguration represents an declarative configuration of the HTTPRouteSpec type for use +// HTTPRouteSpecApplyConfiguration represents a declarative configuration of the HTTPRouteSpec type for use // with apply. type HTTPRouteSpecApplyConfiguration struct { CommonRouteSpecApplyConfiguration `json:",inline"` @@ -30,7 +30,7 @@ type HTTPRouteSpecApplyConfiguration struct { Rules []HTTPRouteRuleApplyConfiguration `json:"rules,omitempty"` } -// HTTPRouteSpecApplyConfiguration constructs an declarative configuration of the HTTPRouteSpec type for use with +// HTTPRouteSpecApplyConfiguration constructs a declarative configuration of the HTTPRouteSpec type for use with // apply. func HTTPRouteSpec() *HTTPRouteSpecApplyConfiguration { return &HTTPRouteSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutestatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutestatus.go index 5d87f89ec5..d7fce10d1e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutestatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutestatus.go @@ -18,13 +18,13 @@ limitations under the License. package v1 -// HTTPRouteStatusApplyConfiguration represents an declarative configuration of the HTTPRouteStatus type for use +// HTTPRouteStatusApplyConfiguration represents a declarative configuration of the HTTPRouteStatus type for use // with apply. type HTTPRouteStatusApplyConfiguration struct { RouteStatusApplyConfiguration `json:",inline"` } -// HTTPRouteStatusApplyConfiguration constructs an declarative configuration of the HTTPRouteStatus type for use with +// HTTPRouteStatusApplyConfiguration constructs a declarative configuration of the HTTPRouteStatus type for use with // apply. func HTTPRouteStatus() *HTTPRouteStatusApplyConfiguration { return &HTTPRouteStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutetimeouts.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutetimeouts.go index 4594ff17d3..98a1a9909a 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutetimeouts.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httproutetimeouts.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPRouteTimeoutsApplyConfiguration represents an declarative configuration of the HTTPRouteTimeouts type for use +// HTTPRouteTimeoutsApplyConfiguration represents a declarative configuration of the HTTPRouteTimeouts type for use // with apply. type HTTPRouteTimeoutsApplyConfiguration struct { Request *v1.Duration `json:"request,omitempty"` BackendRequest *v1.Duration `json:"backendRequest,omitempty"` } -// HTTPRouteTimeoutsApplyConfiguration constructs an declarative configuration of the HTTPRouteTimeouts type for use with +// HTTPRouteTimeoutsApplyConfiguration constructs a declarative configuration of the HTTPRouteTimeouts type for use with // apply. func HTTPRouteTimeouts() *HTTPRouteTimeoutsApplyConfiguration { return &HTTPRouteTimeoutsApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpurlrewritefilter.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpurlrewritefilter.go index cf8e0130cb..9761c24c28 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpurlrewritefilter.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/httpurlrewritefilter.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// HTTPURLRewriteFilterApplyConfiguration represents an declarative configuration of the HTTPURLRewriteFilter type for use +// HTTPURLRewriteFilterApplyConfiguration represents a declarative configuration of the HTTPURLRewriteFilter type for use // with apply. type HTTPURLRewriteFilterApplyConfiguration struct { Hostname *v1.PreciseHostname `json:"hostname,omitempty"` Path *HTTPPathModifierApplyConfiguration `json:"path,omitempty"` } -// HTTPURLRewriteFilterApplyConfiguration constructs an declarative configuration of the HTTPURLRewriteFilter type for use with +// HTTPURLRewriteFilterApplyConfiguration constructs a declarative configuration of the HTTPURLRewriteFilter type for use with // apply. func HTTPURLRewriteFilter() *HTTPURLRewriteFilterApplyConfiguration { return &HTTPURLRewriteFilterApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listener.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listener.go index b65c09030c..5301fa46de 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listener.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listener.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ListenerApplyConfiguration represents an declarative configuration of the Listener type for use +// ListenerApplyConfiguration represents a declarative configuration of the Listener type for use // with apply. type ListenerApplyConfiguration struct { Name *v1.SectionName `json:"name,omitempty"` @@ -33,7 +33,7 @@ type ListenerApplyConfiguration struct { AllowedRoutes *AllowedRoutesApplyConfiguration `json:"allowedRoutes,omitempty"` } -// ListenerApplyConfiguration constructs an declarative configuration of the Listener type for use with +// ListenerApplyConfiguration constructs a declarative configuration of the Listener type for use with // apply. func Listener() *ListenerApplyConfiguration { return &ListenerApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listenerstatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listenerstatus.go index 4e4054ec9f..88a877c6dc 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listenerstatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/listenerstatus.go @@ -20,11 +20,10 @@ package v1 import ( metav1 "k8s.io/client-go/applyconfigurations/meta/v1" - v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ListenerStatusApplyConfiguration represents an declarative configuration of the ListenerStatus type for use +// ListenerStatusApplyConfiguration represents a declarative configuration of the ListenerStatus type for use // with apply. type ListenerStatusApplyConfiguration struct { Name *v1.SectionName `json:"name,omitempty"` @@ -33,7 +32,7 @@ type ListenerStatusApplyConfiguration struct { Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` } -// ListenerStatusApplyConfiguration constructs an declarative configuration of the ListenerStatus type for use with +// ListenerStatusApplyConfiguration constructs a declarative configuration of the ListenerStatus type for use with // apply. func ListenerStatus() *ListenerStatusApplyConfiguration { return &ListenerStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localobjectreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localobjectreference.go index 1bb4b9a816..7d7c7a121b 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localobjectreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localobjectreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// LocalObjectReferenceApplyConfiguration represents an declarative configuration of the LocalObjectReference type for use +// LocalObjectReferenceApplyConfiguration represents a declarative configuration of the LocalObjectReference type for use // with apply. type LocalObjectReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -30,7 +30,7 @@ type LocalObjectReferenceApplyConfiguration struct { Name *v1.ObjectName `json:"name,omitempty"` } -// LocalObjectReferenceApplyConfiguration constructs an declarative configuration of the LocalObjectReference type for use with +// LocalObjectReferenceApplyConfiguration constructs a declarative configuration of the LocalObjectReference type for use with // apply. func LocalObjectReference() *LocalObjectReferenceApplyConfiguration { return &LocalObjectReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localparametersreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localparametersreference.go index d15c55b776..cde618b044 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localparametersreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/localparametersreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// LocalParametersReferenceApplyConfiguration represents an declarative configuration of the LocalParametersReference type for use +// LocalParametersReferenceApplyConfiguration represents a declarative configuration of the LocalParametersReference type for use // with apply. type LocalParametersReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -30,7 +30,7 @@ type LocalParametersReferenceApplyConfiguration struct { Name *string `json:"name,omitempty"` } -// LocalParametersReferenceApplyConfiguration constructs an declarative configuration of the LocalParametersReference type for use with +// LocalParametersReferenceApplyConfiguration constructs a declarative configuration of the LocalParametersReference type for use with // apply. func LocalParametersReference() *LocalParametersReferenceApplyConfiguration { return &LocalParametersReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/objectreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/objectreference.go index 4580fe61a9..b35f2eaf02 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/objectreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/objectreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ObjectReferenceApplyConfiguration represents an declarative configuration of the ObjectReference type for use +// ObjectReferenceApplyConfiguration represents a declarative configuration of the ObjectReference type for use // with apply. type ObjectReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -31,7 +31,7 @@ type ObjectReferenceApplyConfiguration struct { Namespace *v1.Namespace `json:"namespace,omitempty"` } -// ObjectReferenceApplyConfiguration constructs an declarative configuration of the ObjectReference type for use with +// ObjectReferenceApplyConfiguration constructs a declarative configuration of the ObjectReference type for use with // apply. func ObjectReference() *ObjectReferenceApplyConfiguration { return &ObjectReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parametersreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parametersreference.go index b7a3ae27dc..2f245e5373 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parametersreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parametersreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ParametersReferenceApplyConfiguration represents an declarative configuration of the ParametersReference type for use +// ParametersReferenceApplyConfiguration represents a declarative configuration of the ParametersReference type for use // with apply. type ParametersReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -31,7 +31,7 @@ type ParametersReferenceApplyConfiguration struct { Namespace *v1.Namespace `json:"namespace,omitempty"` } -// ParametersReferenceApplyConfiguration constructs an declarative configuration of the ParametersReference type for use with +// ParametersReferenceApplyConfiguration constructs a declarative configuration of the ParametersReference type for use with // apply. func ParametersReference() *ParametersReferenceApplyConfiguration { return &ParametersReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parentreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parentreference.go index 2c39a83441..612dd2afab 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parentreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/parentreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ParentReferenceApplyConfiguration represents an declarative configuration of the ParentReference type for use +// ParentReferenceApplyConfiguration represents a declarative configuration of the ParentReference type for use // with apply. type ParentReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -33,7 +33,7 @@ type ParentReferenceApplyConfiguration struct { Port *v1.PortNumber `json:"port,omitempty"` } -// ParentReferenceApplyConfiguration constructs an declarative configuration of the ParentReference type for use with +// ParentReferenceApplyConfiguration constructs a declarative configuration of the ParentReference type for use with // apply. func ParentReference() *ParentReferenceApplyConfiguration { return &ParentReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routegroupkind.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routegroupkind.go index 84a9b57a2e..470ae4074f 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routegroupkind.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routegroupkind.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// RouteGroupKindApplyConfiguration represents an declarative configuration of the RouteGroupKind type for use +// RouteGroupKindApplyConfiguration represents a declarative configuration of the RouteGroupKind type for use // with apply. type RouteGroupKindApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` Kind *v1.Kind `json:"kind,omitempty"` } -// RouteGroupKindApplyConfiguration constructs an declarative configuration of the RouteGroupKind type for use with +// RouteGroupKindApplyConfiguration constructs a declarative configuration of the RouteGroupKind type for use with // apply. func RouteGroupKind() *RouteGroupKindApplyConfiguration { return &RouteGroupKindApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routenamespaces.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routenamespaces.go index 9b60a56130..33a172897c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routenamespaces.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routenamespaces.go @@ -23,14 +23,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// RouteNamespacesApplyConfiguration represents an declarative configuration of the RouteNamespaces type for use +// RouteNamespacesApplyConfiguration represents a declarative configuration of the RouteNamespaces type for use // with apply. type RouteNamespacesApplyConfiguration struct { From *v1.FromNamespaces `json:"from,omitempty"` Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` } -// RouteNamespacesApplyConfiguration constructs an declarative configuration of the RouteNamespaces type for use with +// RouteNamespacesApplyConfiguration constructs a declarative configuration of the RouteNamespaces type for use with // apply. func RouteNamespaces() *RouteNamespacesApplyConfiguration { return &RouteNamespacesApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routeparentstatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routeparentstatus.go index 1237133547..f52901e544 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routeparentstatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routeparentstatus.go @@ -20,11 +20,10 @@ package v1 import ( metav1 "k8s.io/client-go/applyconfigurations/meta/v1" - apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// RouteParentStatusApplyConfiguration represents an declarative configuration of the RouteParentStatus type for use +// RouteParentStatusApplyConfiguration represents a declarative configuration of the RouteParentStatus type for use // with apply. type RouteParentStatusApplyConfiguration struct { ParentRef *ParentReferenceApplyConfiguration `json:"parentRef,omitempty"` @@ -32,7 +31,7 @@ type RouteParentStatusApplyConfiguration struct { Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` } -// RouteParentStatusApplyConfiguration constructs an declarative configuration of the RouteParentStatus type for use with +// RouteParentStatusApplyConfiguration constructs a declarative configuration of the RouteParentStatus type for use with // apply. func RouteParentStatus() *RouteParentStatusApplyConfiguration { return &RouteParentStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routestatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routestatus.go index 5ef84f8028..0502272abb 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routestatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/routestatus.go @@ -18,13 +18,13 @@ limitations under the License. package v1 -// RouteStatusApplyConfiguration represents an declarative configuration of the RouteStatus type for use +// RouteStatusApplyConfiguration represents a declarative configuration of the RouteStatus type for use // with apply. type RouteStatusApplyConfiguration struct { Parents []RouteParentStatusApplyConfiguration `json:"parents,omitempty"` } -// RouteStatusApplyConfiguration constructs an declarative configuration of the RouteStatus type for use with +// RouteStatusApplyConfiguration constructs a declarative configuration of the RouteStatus type for use with // apply. func RouteStatus() *RouteStatusApplyConfiguration { return &RouteStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/secretobjectreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/secretobjectreference.go index 771fdb0ab3..654f898232 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/secretobjectreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/secretobjectreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// SecretObjectReferenceApplyConfiguration represents an declarative configuration of the SecretObjectReference type for use +// SecretObjectReferenceApplyConfiguration represents a declarative configuration of the SecretObjectReference type for use // with apply. type SecretObjectReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -31,7 +31,7 @@ type SecretObjectReferenceApplyConfiguration struct { Namespace *v1.Namespace `json:"namespace,omitempty"` } -// SecretObjectReferenceApplyConfiguration constructs an declarative configuration of the SecretObjectReference type for use with +// SecretObjectReferenceApplyConfiguration constructs a declarative configuration of the SecretObjectReference type for use with // apply. func SecretObjectReference() *SecretObjectReferenceApplyConfiguration { return &SecretObjectReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/sessionpersistence.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/sessionpersistence.go index 7b9de44e3b..b20b07ce86 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/sessionpersistence.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/sessionpersistence.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// SessionPersistenceApplyConfiguration represents an declarative configuration of the SessionPersistence type for use +// SessionPersistenceApplyConfiguration represents a declarative configuration of the SessionPersistence type for use // with apply. type SessionPersistenceApplyConfiguration struct { SessionName *string `json:"sessionName,omitempty"` @@ -32,7 +32,7 @@ type SessionPersistenceApplyConfiguration struct { CookieConfig *CookieConfigApplyConfiguration `json:"cookieConfig,omitempty"` } -// SessionPersistenceApplyConfiguration constructs an declarative configuration of the SessionPersistence type for use with +// SessionPersistenceApplyConfiguration constructs a declarative configuration of the SessionPersistence type for use with // apply. func SessionPersistence() *SessionPersistenceApplyConfiguration { return &SessionPersistenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/supportedfeature.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/supportedfeature.go new file mode 100644 index 0000000000..90de05d24d --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1/supportedfeature.go @@ -0,0 +1,43 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" +) + +// SupportedFeatureApplyConfiguration represents a declarative configuration of the SupportedFeature type for use +// with apply. +type SupportedFeatureApplyConfiguration struct { + Name *v1.FeatureName `json:"name,omitempty"` +} + +// SupportedFeatureApplyConfiguration constructs a declarative configuration of the SupportedFeature type for use with +// apply. +func SupportedFeature() *SupportedFeatureApplyConfiguration { + return &SupportedFeatureApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SupportedFeatureApplyConfiguration) WithName(value v1.FeatureName) *SupportedFeatureApplyConfiguration { + b.Name = &value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicy.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicy.go index 835bf3c9d4..e63c8cd653 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicy.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) -// BackendLBPolicyApplyConfiguration represents an declarative configuration of the BackendLBPolicy type for use +// BackendLBPolicyApplyConfiguration represents a declarative configuration of the BackendLBPolicy type for use // with apply. type BackendLBPolicyApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type BackendLBPolicyApplyConfiguration struct { Status *PolicyStatusApplyConfiguration `json:"status,omitempty"` } -// BackendLBPolicy constructs an declarative configuration of the BackendLBPolicy type for use with +// BackendLBPolicy constructs a declarative configuration of the BackendLBPolicy type for use with // apply. func BackendLBPolicy(name, namespace string) *BackendLBPolicyApplyConfiguration { b := &BackendLBPolicyApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *BackendLBPolicyApplyConfiguration) WithStatus(value *PolicyStatusApplyC b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *BackendLBPolicyApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicyspec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicyspec.go index c233994c63..b443579a6b 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicyspec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/backendlbpolicyspec.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" ) -// BackendLBPolicySpecApplyConfiguration represents an declarative configuration of the BackendLBPolicySpec type for use +// BackendLBPolicySpecApplyConfiguration represents a declarative configuration of the BackendLBPolicySpec type for use // with apply. type BackendLBPolicySpecApplyConfiguration struct { TargetRefs []LocalPolicyTargetReferenceApplyConfiguration `json:"targetRefs,omitempty"` SessionPersistence *v1.SessionPersistenceApplyConfiguration `json:"sessionPersistence,omitempty"` } -// BackendLBPolicySpecApplyConfiguration constructs an declarative configuration of the BackendLBPolicySpec type for use with +// BackendLBPolicySpecApplyConfiguration constructs a declarative configuration of the BackendLBPolicySpec type for use with // apply. func BackendLBPolicySpec() *BackendLBPolicySpecApplyConfiguration { return &BackendLBPolicySpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/grpcroute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/grpcroute.go index cc095e08c1..7e6f806b2c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/grpcroute.go @@ -28,7 +28,7 @@ import ( v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) -// GRPCRouteApplyConfiguration represents an declarative configuration of the GRPCRoute type for use +// GRPCRouteApplyConfiguration represents a declarative configuration of the GRPCRoute type for use // with apply. type GRPCRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +37,7 @@ type GRPCRouteApplyConfiguration struct { Status *apisv1.GRPCRouteStatusApplyConfiguration `json:"status,omitempty"` } -// GRPCRoute constructs an declarative configuration of the GRPCRoute type for use with +// GRPCRoute constructs a declarative configuration of the GRPCRoute type for use with // apply. func GRPCRoute(name, namespace string) *GRPCRouteApplyConfiguration { b := &GRPCRouteApplyConfiguration{} @@ -257,3 +257,9 @@ func (b *GRPCRouteApplyConfiguration) WithStatus(value *apisv1.GRPCRouteStatusAp b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *GRPCRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreference.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreference.go index b4999d79cf..9560a9a49c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreference.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreference.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// LocalPolicyTargetReferenceApplyConfiguration represents an declarative configuration of the LocalPolicyTargetReference type for use +// LocalPolicyTargetReferenceApplyConfiguration represents a declarative configuration of the LocalPolicyTargetReference type for use // with apply. type LocalPolicyTargetReferenceApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -30,7 +30,7 @@ type LocalPolicyTargetReferenceApplyConfiguration struct { Name *v1.ObjectName `json:"name,omitempty"` } -// LocalPolicyTargetReferenceApplyConfiguration constructs an declarative configuration of the LocalPolicyTargetReference type for use with +// LocalPolicyTargetReferenceApplyConfiguration constructs a declarative configuration of the LocalPolicyTargetReference type for use with // apply. func LocalPolicyTargetReference() *LocalPolicyTargetReferenceApplyConfiguration { return &LocalPolicyTargetReferenceApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreferencewithsectionname.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreferencewithsectionname.go index 259da87bc3..72577d01c2 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreferencewithsectionname.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/localpolicytargetreferencewithsectionname.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// LocalPolicyTargetReferenceWithSectionNameApplyConfiguration represents an declarative configuration of the LocalPolicyTargetReferenceWithSectionName type for use +// LocalPolicyTargetReferenceWithSectionNameApplyConfiguration represents a declarative configuration of the LocalPolicyTargetReferenceWithSectionName type for use // with apply. type LocalPolicyTargetReferenceWithSectionNameApplyConfiguration struct { LocalPolicyTargetReferenceApplyConfiguration `json:",inline"` SectionName *v1.SectionName `json:"sectionName,omitempty"` } -// LocalPolicyTargetReferenceWithSectionNameApplyConfiguration constructs an declarative configuration of the LocalPolicyTargetReferenceWithSectionName type for use with +// LocalPolicyTargetReferenceWithSectionNameApplyConfiguration constructs a declarative configuration of the LocalPolicyTargetReferenceWithSectionName type for use with // apply. func LocalPolicyTargetReferenceWithSectionName() *LocalPolicyTargetReferenceWithSectionNameApplyConfiguration { return &LocalPolicyTargetReferenceWithSectionNameApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policyancestorstatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policyancestorstatus.go index f43e15e4bf..d59b5c78ae 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policyancestorstatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policyancestorstatus.go @@ -24,7 +24,7 @@ import ( apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// PolicyAncestorStatusApplyConfiguration represents an declarative configuration of the PolicyAncestorStatus type for use +// PolicyAncestorStatusApplyConfiguration represents a declarative configuration of the PolicyAncestorStatus type for use // with apply. type PolicyAncestorStatusApplyConfiguration struct { AncestorRef *v1.ParentReferenceApplyConfiguration `json:"ancestorRef,omitempty"` @@ -32,7 +32,7 @@ type PolicyAncestorStatusApplyConfiguration struct { Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` } -// PolicyAncestorStatusApplyConfiguration constructs an declarative configuration of the PolicyAncestorStatus type for use with +// PolicyAncestorStatusApplyConfiguration constructs a declarative configuration of the PolicyAncestorStatus type for use with // apply. func PolicyAncestorStatus() *PolicyAncestorStatusApplyConfiguration { return &PolicyAncestorStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policystatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policystatus.go index 86063588f5..b7b158b29a 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policystatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/policystatus.go @@ -18,13 +18,13 @@ limitations under the License. package v1alpha2 -// PolicyStatusApplyConfiguration represents an declarative configuration of the PolicyStatus type for use +// PolicyStatusApplyConfiguration represents a declarative configuration of the PolicyStatus type for use // with apply. type PolicyStatusApplyConfiguration struct { Ancestors []PolicyAncestorStatusApplyConfiguration `json:"ancestors,omitempty"` } -// PolicyStatusApplyConfiguration constructs an declarative configuration of the PolicyStatus type for use with +// PolicyStatusApplyConfiguration constructs a declarative configuration of the PolicyStatus type for use with // apply. func PolicyStatus() *PolicyStatusApplyConfiguration { return &PolicyStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/referencegrant.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/referencegrant.go index f7a7f4d1ad..e25a74a63e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/referencegrant.go @@ -28,7 +28,7 @@ import ( v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) -// ReferenceGrantApplyConfiguration represents an declarative configuration of the ReferenceGrant type for use +// ReferenceGrantApplyConfiguration represents a declarative configuration of the ReferenceGrant type for use // with apply. type ReferenceGrantApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -36,7 +36,7 @@ type ReferenceGrantApplyConfiguration struct { Spec *v1beta1.ReferenceGrantSpecApplyConfiguration `json:"spec,omitempty"` } -// ReferenceGrant constructs an declarative configuration of the ReferenceGrant type for use with +// ReferenceGrant constructs a declarative configuration of the ReferenceGrant type for use with // apply. func ReferenceGrant(name, namespace string) *ReferenceGrantApplyConfiguration { b := &ReferenceGrantApplyConfiguration{} @@ -248,3 +248,9 @@ func (b *ReferenceGrantApplyConfiguration) WithSpec(value *v1beta1.ReferenceGran b.Spec = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ReferenceGrantApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproute.go index ed6cfbfd41..1edbd0d753 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproute.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) -// TCPRouteApplyConfiguration represents an declarative configuration of the TCPRoute type for use +// TCPRouteApplyConfiguration represents a declarative configuration of the TCPRoute type for use // with apply. type TCPRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type TCPRouteApplyConfiguration struct { Status *TCPRouteStatusApplyConfiguration `json:"status,omitempty"` } -// TCPRoute constructs an declarative configuration of the TCPRoute type for use with +// TCPRoute constructs a declarative configuration of the TCPRoute type for use with // apply. func TCPRoute(name, namespace string) *TCPRouteApplyConfiguration { b := &TCPRouteApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *TCPRouteApplyConfiguration) WithStatus(value *TCPRouteStatusApplyConfig b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TCPRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcprouterule.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcprouterule.go index 3c6e418c2f..450d89992d 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcprouterule.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcprouterule.go @@ -19,25 +19,35 @@ limitations under the License. package v1alpha2 import ( - v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// TCPRouteRuleApplyConfiguration represents an declarative configuration of the TCPRouteRule type for use +// TCPRouteRuleApplyConfiguration represents a declarative configuration of the TCPRouteRule type for use // with apply. type TCPRouteRuleApplyConfiguration struct { - BackendRefs []v1.BackendRefApplyConfiguration `json:"backendRefs,omitempty"` + Name *v1.SectionName `json:"name,omitempty"` + BackendRefs []apisv1.BackendRefApplyConfiguration `json:"backendRefs,omitempty"` } -// TCPRouteRuleApplyConfiguration constructs an declarative configuration of the TCPRouteRule type for use with +// TCPRouteRuleApplyConfiguration constructs a declarative configuration of the TCPRouteRule type for use with // apply. func TCPRouteRule() *TCPRouteRuleApplyConfiguration { return &TCPRouteRuleApplyConfiguration{} } +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TCPRouteRuleApplyConfiguration) WithName(value v1.SectionName) *TCPRouteRuleApplyConfiguration { + b.Name = &value + return b +} + // WithBackendRefs adds the given value to the BackendRefs field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the BackendRefs field. -func (b *TCPRouteRuleApplyConfiguration) WithBackendRefs(values ...*v1.BackendRefApplyConfiguration) *TCPRouteRuleApplyConfiguration { +func (b *TCPRouteRuleApplyConfiguration) WithBackendRefs(values ...*apisv1.BackendRefApplyConfiguration) *TCPRouteRuleApplyConfiguration { for i := range values { if values[i] == nil { panic("nil value passed to WithBackendRefs") diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutespec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutespec.go index 62fdffc7c7..375a7f4b16 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutespec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutespec.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" ) -// TCPRouteSpecApplyConfiguration represents an declarative configuration of the TCPRouteSpec type for use +// TCPRouteSpecApplyConfiguration represents a declarative configuration of the TCPRouteSpec type for use // with apply. type TCPRouteSpecApplyConfiguration struct { v1.CommonRouteSpecApplyConfiguration `json:",inline"` Rules []TCPRouteRuleApplyConfiguration `json:"rules,omitempty"` } -// TCPRouteSpecApplyConfiguration constructs an declarative configuration of the TCPRouteSpec type for use with +// TCPRouteSpecApplyConfiguration constructs a declarative configuration of the TCPRouteSpec type for use with // apply. func TCPRouteSpec() *TCPRouteSpecApplyConfiguration { return &TCPRouteSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutestatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutestatus.go index 74be49a173..a32ffd2bfd 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutestatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tcproutestatus.go @@ -22,13 +22,13 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" ) -// TCPRouteStatusApplyConfiguration represents an declarative configuration of the TCPRouteStatus type for use +// TCPRouteStatusApplyConfiguration represents a declarative configuration of the TCPRouteStatus type for use // with apply. type TCPRouteStatusApplyConfiguration struct { v1.RouteStatusApplyConfiguration `json:",inline"` } -// TCPRouteStatusApplyConfiguration constructs an declarative configuration of the TCPRouteStatus type for use with +// TCPRouteStatusApplyConfiguration constructs a declarative configuration of the TCPRouteStatus type for use with // apply. func TCPRouteStatus() *TCPRouteStatusApplyConfiguration { return &TCPRouteStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroute.go index 8a22aa8d66..5cfdd67395 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroute.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) -// TLSRouteApplyConfiguration represents an declarative configuration of the TLSRoute type for use +// TLSRouteApplyConfiguration represents a declarative configuration of the TLSRoute type for use // with apply. type TLSRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type TLSRouteApplyConfiguration struct { Status *TLSRouteStatusApplyConfiguration `json:"status,omitempty"` } -// TLSRoute constructs an declarative configuration of the TLSRoute type for use with +// TLSRoute constructs a declarative configuration of the TLSRoute type for use with // apply. func TLSRoute(name, namespace string) *TLSRouteApplyConfiguration { b := &TLSRouteApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *TLSRouteApplyConfiguration) WithStatus(value *TLSRouteStatusApplyConfig b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *TLSRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsrouterule.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsrouterule.go index a2dacdf9b8..e7124fc866 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsrouterule.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsrouterule.go @@ -19,25 +19,35 @@ limitations under the License. package v1alpha2 import ( - v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// TLSRouteRuleApplyConfiguration represents an declarative configuration of the TLSRouteRule type for use +// TLSRouteRuleApplyConfiguration represents a declarative configuration of the TLSRouteRule type for use // with apply. type TLSRouteRuleApplyConfiguration struct { - BackendRefs []v1.BackendRefApplyConfiguration `json:"backendRefs,omitempty"` + Name *v1.SectionName `json:"name,omitempty"` + BackendRefs []apisv1.BackendRefApplyConfiguration `json:"backendRefs,omitempty"` } -// TLSRouteRuleApplyConfiguration constructs an declarative configuration of the TLSRouteRule type for use with +// TLSRouteRuleApplyConfiguration constructs a declarative configuration of the TLSRouteRule type for use with // apply. func TLSRouteRule() *TLSRouteRuleApplyConfiguration { return &TLSRouteRuleApplyConfiguration{} } +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *TLSRouteRuleApplyConfiguration) WithName(value v1.SectionName) *TLSRouteRuleApplyConfiguration { + b.Name = &value + return b +} + // WithBackendRefs adds the given value to the BackendRefs field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the BackendRefs field. -func (b *TLSRouteRuleApplyConfiguration) WithBackendRefs(values ...*v1.BackendRefApplyConfiguration) *TLSRouteRuleApplyConfiguration { +func (b *TLSRouteRuleApplyConfiguration) WithBackendRefs(values ...*apisv1.BackendRefApplyConfiguration) *TLSRouteRuleApplyConfiguration { for i := range values { if values[i] == nil { panic("nil value passed to WithBackendRefs") diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutespec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutespec.go index 0de333f9ff..a8e3745ff2 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutespec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutespec.go @@ -20,11 +20,10 @@ package v1alpha2 import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" - apisv1 "sigs.k8s.io/gateway-api/apis/v1" ) -// TLSRouteSpecApplyConfiguration represents an declarative configuration of the TLSRouteSpec type for use +// TLSRouteSpecApplyConfiguration represents a declarative configuration of the TLSRouteSpec type for use // with apply. type TLSRouteSpecApplyConfiguration struct { v1.CommonRouteSpecApplyConfiguration `json:",inline"` @@ -32,7 +31,7 @@ type TLSRouteSpecApplyConfiguration struct { Rules []TLSRouteRuleApplyConfiguration `json:"rules,omitempty"` } -// TLSRouteSpecApplyConfiguration constructs an declarative configuration of the TLSRouteSpec type for use with +// TLSRouteSpecApplyConfiguration constructs a declarative configuration of the TLSRouteSpec type for use with // apply. func TLSRouteSpec() *TLSRouteSpecApplyConfiguration { return &TLSRouteSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutestatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutestatus.go index f8677962c2..4f0cb40826 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutestatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/tlsroutestatus.go @@ -22,13 +22,13 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" ) -// TLSRouteStatusApplyConfiguration represents an declarative configuration of the TLSRouteStatus type for use +// TLSRouteStatusApplyConfiguration represents a declarative configuration of the TLSRouteStatus type for use // with apply. type TLSRouteStatusApplyConfiguration struct { v1.RouteStatusApplyConfiguration `json:",inline"` } -// TLSRouteStatusApplyConfiguration constructs an declarative configuration of the TLSRouteStatus type for use with +// TLSRouteStatusApplyConfiguration constructs a declarative configuration of the TLSRouteStatus type for use with // apply. func TLSRouteStatus() *TLSRouteStatusApplyConfiguration { return &TLSRouteStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproute.go index ba4d21f60f..377e85d87e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproute.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) -// UDPRouteApplyConfiguration represents an declarative configuration of the UDPRoute type for use +// UDPRouteApplyConfiguration represents a declarative configuration of the UDPRoute type for use // with apply. type UDPRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +36,7 @@ type UDPRouteApplyConfiguration struct { Status *UDPRouteStatusApplyConfiguration `json:"status,omitempty"` } -// UDPRoute constructs an declarative configuration of the UDPRoute type for use with +// UDPRoute constructs a declarative configuration of the UDPRoute type for use with // apply. func UDPRoute(name, namespace string) *UDPRouteApplyConfiguration { b := &UDPRouteApplyConfiguration{} @@ -257,3 +256,9 @@ func (b *UDPRouteApplyConfiguration) WithStatus(value *UDPRouteStatusApplyConfig b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *UDPRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udprouterule.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udprouterule.go index 8cc077ecc9..fd6171a2c7 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udprouterule.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udprouterule.go @@ -19,25 +19,35 @@ limitations under the License. package v1alpha2 import ( - v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// UDPRouteRuleApplyConfiguration represents an declarative configuration of the UDPRouteRule type for use +// UDPRouteRuleApplyConfiguration represents a declarative configuration of the UDPRouteRule type for use // with apply. type UDPRouteRuleApplyConfiguration struct { - BackendRefs []v1.BackendRefApplyConfiguration `json:"backendRefs,omitempty"` + Name *v1.SectionName `json:"name,omitempty"` + BackendRefs []apisv1.BackendRefApplyConfiguration `json:"backendRefs,omitempty"` } -// UDPRouteRuleApplyConfiguration constructs an declarative configuration of the UDPRouteRule type for use with +// UDPRouteRuleApplyConfiguration constructs a declarative configuration of the UDPRouteRule type for use with // apply. func UDPRouteRule() *UDPRouteRuleApplyConfiguration { return &UDPRouteRuleApplyConfiguration{} } +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *UDPRouteRuleApplyConfiguration) WithName(value v1.SectionName) *UDPRouteRuleApplyConfiguration { + b.Name = &value + return b +} + // WithBackendRefs adds the given value to the BackendRefs field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the BackendRefs field. -func (b *UDPRouteRuleApplyConfiguration) WithBackendRefs(values ...*v1.BackendRefApplyConfiguration) *UDPRouteRuleApplyConfiguration { +func (b *UDPRouteRuleApplyConfiguration) WithBackendRefs(values ...*apisv1.BackendRefApplyConfiguration) *UDPRouteRuleApplyConfiguration { for i := range values { if values[i] == nil { panic("nil value passed to WithBackendRefs") diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutespec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutespec.go index e73fb75d30..eed193696b 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutespec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutespec.go @@ -22,14 +22,14 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" ) -// UDPRouteSpecApplyConfiguration represents an declarative configuration of the UDPRouteSpec type for use +// UDPRouteSpecApplyConfiguration represents a declarative configuration of the UDPRouteSpec type for use // with apply. type UDPRouteSpecApplyConfiguration struct { v1.CommonRouteSpecApplyConfiguration `json:",inline"` Rules []UDPRouteRuleApplyConfiguration `json:"rules,omitempty"` } -// UDPRouteSpecApplyConfiguration constructs an declarative configuration of the UDPRouteSpec type for use with +// UDPRouteSpecApplyConfiguration constructs a declarative configuration of the UDPRouteSpec type for use with // apply. func UDPRouteSpec() *UDPRouteSpecApplyConfiguration { return &UDPRouteSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutestatus.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutestatus.go index 453004a652..57abcf15a2 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutestatus.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2/udproutestatus.go @@ -22,13 +22,13 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" ) -// UDPRouteStatusApplyConfiguration represents an declarative configuration of the UDPRouteStatus type for use +// UDPRouteStatusApplyConfiguration represents a declarative configuration of the UDPRouteStatus type for use // with apply. type UDPRouteStatusApplyConfiguration struct { v1.RouteStatusApplyConfiguration `json:",inline"` } -// UDPRouteStatusApplyConfiguration constructs an declarative configuration of the UDPRouteStatus type for use with +// UDPRouteStatusApplyConfiguration constructs a declarative configuration of the UDPRouteStatus type for use with // apply. func UDPRouteStatus() *UDPRouteStatusApplyConfiguration { return &UDPRouteStatusApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicy.go index 5d8f6dfa63..5cbf6a8d9e 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicy.go @@ -24,12 +24,11 @@ import ( managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" v1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" apisv1alpha3 "sigs.k8s.io/gateway-api/apis/v1alpha3" ) -// BackendTLSPolicyApplyConfiguration represents an declarative configuration of the BackendTLSPolicy type for use +// BackendTLSPolicyApplyConfiguration represents a declarative configuration of the BackendTLSPolicy type for use // with apply. type BackendTLSPolicyApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -38,7 +37,7 @@ type BackendTLSPolicyApplyConfiguration struct { Status *v1alpha2.PolicyStatusApplyConfiguration `json:"status,omitempty"` } -// BackendTLSPolicy constructs an declarative configuration of the BackendTLSPolicy type for use with +// BackendTLSPolicy constructs a declarative configuration of the BackendTLSPolicy type for use with // apply. func BackendTLSPolicy(name, namespace string) *BackendTLSPolicyApplyConfiguration { b := &BackendTLSPolicyApplyConfiguration{} @@ -258,3 +257,9 @@ func (b *BackendTLSPolicyApplyConfiguration) WithStatus(value *v1alpha2.PolicySt b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *BackendTLSPolicyApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyspec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyspec.go index 16b16a8cbc..5290a35fa0 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyspec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyspec.go @@ -20,16 +20,18 @@ package v1alpha3 import ( v1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" + v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// BackendTLSPolicySpecApplyConfiguration represents an declarative configuration of the BackendTLSPolicySpec type for use +// BackendTLSPolicySpecApplyConfiguration represents a declarative configuration of the BackendTLSPolicySpec type for use // with apply. type BackendTLSPolicySpecApplyConfiguration struct { TargetRefs []v1alpha2.LocalPolicyTargetReferenceWithSectionNameApplyConfiguration `json:"targetRefs,omitempty"` Validation *BackendTLSPolicyValidationApplyConfiguration `json:"validation,omitempty"` + Options map[v1.AnnotationKey]v1.AnnotationValue `json:"options,omitempty"` } -// BackendTLSPolicySpecApplyConfiguration constructs an declarative configuration of the BackendTLSPolicySpec type for use with +// BackendTLSPolicySpecApplyConfiguration constructs a declarative configuration of the BackendTLSPolicySpec type for use with // apply. func BackendTLSPolicySpec() *BackendTLSPolicySpecApplyConfiguration { return &BackendTLSPolicySpecApplyConfiguration{} @@ -55,3 +57,17 @@ func (b *BackendTLSPolicySpecApplyConfiguration) WithValidation(value *BackendTL b.Validation = value return b } + +// WithOptions puts the entries into the Options field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Options field, +// overwriting an existing map entries in Options field with the same key. +func (b *BackendTLSPolicySpecApplyConfiguration) WithOptions(entries map[v1.AnnotationKey]v1.AnnotationValue) *BackendTLSPolicySpecApplyConfiguration { + if b.Options == nil && len(entries) > 0 { + b.Options = make(map[v1.AnnotationKey]v1.AnnotationValue, len(entries)) + } + for k, v := range entries { + b.Options[k] = v + } + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyvalidation.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyvalidation.go index 952c5926b6..1245e2853c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyvalidation.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/backendtlspolicyvalidation.go @@ -24,15 +24,16 @@ import ( v1alpha3 "sigs.k8s.io/gateway-api/apis/v1alpha3" ) -// BackendTLSPolicyValidationApplyConfiguration represents an declarative configuration of the BackendTLSPolicyValidation type for use +// BackendTLSPolicyValidationApplyConfiguration represents a declarative configuration of the BackendTLSPolicyValidation type for use // with apply. type BackendTLSPolicyValidationApplyConfiguration struct { CACertificateRefs []v1.LocalObjectReferenceApplyConfiguration `json:"caCertificateRefs,omitempty"` WellKnownCACertificates *v1alpha3.WellKnownCACertificatesType `json:"wellKnownCACertificates,omitempty"` Hostname *apisv1.PreciseHostname `json:"hostname,omitempty"` + SubjectAltNames []SubjectAltNameApplyConfiguration `json:"subjectAltNames,omitempty"` } -// BackendTLSPolicyValidationApplyConfiguration constructs an declarative configuration of the BackendTLSPolicyValidation type for use with +// BackendTLSPolicyValidationApplyConfiguration constructs a declarative configuration of the BackendTLSPolicyValidation type for use with // apply. func BackendTLSPolicyValidation() *BackendTLSPolicyValidationApplyConfiguration { return &BackendTLSPolicyValidationApplyConfiguration{} @@ -66,3 +67,16 @@ func (b *BackendTLSPolicyValidationApplyConfiguration) WithHostname(value apisv1 b.Hostname = &value return b } + +// WithSubjectAltNames adds the given value to the SubjectAltNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SubjectAltNames field. +func (b *BackendTLSPolicyValidationApplyConfiguration) WithSubjectAltNames(values ...*SubjectAltNameApplyConfiguration) *BackendTLSPolicyValidationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSubjectAltNames") + } + b.SubjectAltNames = append(b.SubjectAltNames, *values[i]) + } + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/subjectaltname.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/subjectaltname.go new file mode 100644 index 0000000000..ae71ef3137 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3/subjectaltname.go @@ -0,0 +1,62 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1 "sigs.k8s.io/gateway-api/apis/v1" + v1alpha3 "sigs.k8s.io/gateway-api/apis/v1alpha3" +) + +// SubjectAltNameApplyConfiguration represents a declarative configuration of the SubjectAltName type for use +// with apply. +type SubjectAltNameApplyConfiguration struct { + Type *v1alpha3.SubjectAltNameType `json:"type,omitempty"` + Hostname *v1.Hostname `json:"hostname,omitempty"` + URI *v1.AbsoluteURI `json:"uri,omitempty"` +} + +// SubjectAltNameApplyConfiguration constructs a declarative configuration of the SubjectAltName type for use with +// apply. +func SubjectAltName() *SubjectAltNameApplyConfiguration { + return &SubjectAltNameApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *SubjectAltNameApplyConfiguration) WithType(value v1alpha3.SubjectAltNameType) *SubjectAltNameApplyConfiguration { + b.Type = &value + return b +} + +// WithHostname sets the Hostname field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Hostname field is set to the value of the last call. +func (b *SubjectAltNameApplyConfiguration) WithHostname(value v1.Hostname) *SubjectAltNameApplyConfiguration { + b.Hostname = &value + return b +} + +// WithURI sets the URI field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URI field is set to the value of the last call. +func (b *SubjectAltNameApplyConfiguration) WithURI(value v1.AbsoluteURI) *SubjectAltNameApplyConfiguration { + b.URI = &value + return b +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gateway.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gateway.go index ced36f358a..8046345c75 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gateway.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gateway.go @@ -28,7 +28,7 @@ import ( v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) -// GatewayApplyConfiguration represents an declarative configuration of the Gateway type for use +// GatewayApplyConfiguration represents a declarative configuration of the Gateway type for use // with apply. type GatewayApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +37,7 @@ type GatewayApplyConfiguration struct { Status *apisv1.GatewayStatusApplyConfiguration `json:"status,omitempty"` } -// Gateway constructs an declarative configuration of the Gateway type for use with +// Gateway constructs a declarative configuration of the Gateway type for use with // apply. func Gateway(name, namespace string) *GatewayApplyConfiguration { b := &GatewayApplyConfiguration{} @@ -257,3 +257,9 @@ func (b *GatewayApplyConfiguration) WithStatus(value *apisv1.GatewayStatusApplyC b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *GatewayApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gatewayclass.go index 6b3c5856c1..938c6ba0a4 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gatewayclass.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/gatewayclass.go @@ -28,7 +28,7 @@ import ( v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) -// GatewayClassApplyConfiguration represents an declarative configuration of the GatewayClass type for use +// GatewayClassApplyConfiguration represents a declarative configuration of the GatewayClass type for use // with apply. type GatewayClassApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +37,7 @@ type GatewayClassApplyConfiguration struct { Status *apisv1.GatewayClassStatusApplyConfiguration `json:"status,omitempty"` } -// GatewayClass constructs an declarative configuration of the GatewayClass type for use with +// GatewayClass constructs a declarative configuration of the GatewayClass type for use with // apply. func GatewayClass(name string) *GatewayClassApplyConfiguration { b := &GatewayClassApplyConfiguration{} @@ -255,3 +255,9 @@ func (b *GatewayClassApplyConfiguration) WithStatus(value *apisv1.GatewayClassSt b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *GatewayClassApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/httproute.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/httproute.go index 221b2fd180..84a40d9a32 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/httproute.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/httproute.go @@ -28,7 +28,7 @@ import ( v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) -// HTTPRouteApplyConfiguration represents an declarative configuration of the HTTPRoute type for use +// HTTPRouteApplyConfiguration represents a declarative configuration of the HTTPRoute type for use // with apply. type HTTPRouteApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -37,7 +37,7 @@ type HTTPRouteApplyConfiguration struct { Status *apisv1.HTTPRouteStatusApplyConfiguration `json:"status,omitempty"` } -// HTTPRoute constructs an declarative configuration of the HTTPRoute type for use with +// HTTPRoute constructs a declarative configuration of the HTTPRoute type for use with // apply. func HTTPRoute(name, namespace string) *HTTPRouteApplyConfiguration { b := &HTTPRouteApplyConfiguration{} @@ -257,3 +257,9 @@ func (b *HTTPRouteApplyConfiguration) WithStatus(value *apisv1.HTTPRouteStatusAp b.Status = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *HTTPRouteApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrant.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrant.go index 4c0c7dc51a..b6b8c2e507 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrant.go @@ -23,12 +23,11 @@ import ( types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" v1 "k8s.io/client-go/applyconfigurations/meta/v1" - internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" apisv1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) -// ReferenceGrantApplyConfiguration represents an declarative configuration of the ReferenceGrant type for use +// ReferenceGrantApplyConfiguration represents a declarative configuration of the ReferenceGrant type for use // with apply. type ReferenceGrantApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` @@ -36,7 +35,7 @@ type ReferenceGrantApplyConfiguration struct { Spec *ReferenceGrantSpecApplyConfiguration `json:"spec,omitempty"` } -// ReferenceGrant constructs an declarative configuration of the ReferenceGrant type for use with +// ReferenceGrant constructs a declarative configuration of the ReferenceGrant type for use with // apply. func ReferenceGrant(name, namespace string) *ReferenceGrantApplyConfiguration { b := &ReferenceGrantApplyConfiguration{} @@ -248,3 +247,9 @@ func (b *ReferenceGrantApplyConfiguration) WithSpec(value *ReferenceGrantSpecApp b.Spec = value return b } + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ReferenceGrantApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.Name +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantfrom.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantfrom.go index fa494a5403..168c1c0308 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantfrom.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantfrom.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ReferenceGrantFromApplyConfiguration represents an declarative configuration of the ReferenceGrantFrom type for use +// ReferenceGrantFromApplyConfiguration represents a declarative configuration of the ReferenceGrantFrom type for use // with apply. type ReferenceGrantFromApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -30,7 +30,7 @@ type ReferenceGrantFromApplyConfiguration struct { Namespace *v1.Namespace `json:"namespace,omitempty"` } -// ReferenceGrantFromApplyConfiguration constructs an declarative configuration of the ReferenceGrantFrom type for use with +// ReferenceGrantFromApplyConfiguration constructs a declarative configuration of the ReferenceGrantFrom type for use with // apply. func ReferenceGrantFrom() *ReferenceGrantFromApplyConfiguration { return &ReferenceGrantFromApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantspec.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantspec.go index 9fc339fcd8..f70297fcb0 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantspec.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantspec.go @@ -18,14 +18,14 @@ limitations under the License. package v1beta1 -// ReferenceGrantSpecApplyConfiguration represents an declarative configuration of the ReferenceGrantSpec type for use +// ReferenceGrantSpecApplyConfiguration represents a declarative configuration of the ReferenceGrantSpec type for use // with apply. type ReferenceGrantSpecApplyConfiguration struct { From []ReferenceGrantFromApplyConfiguration `json:"from,omitempty"` To []ReferenceGrantToApplyConfiguration `json:"to,omitempty"` } -// ReferenceGrantSpecApplyConfiguration constructs an declarative configuration of the ReferenceGrantSpec type for use with +// ReferenceGrantSpecApplyConfiguration constructs a declarative configuration of the ReferenceGrantSpec type for use with // apply. func ReferenceGrantSpec() *ReferenceGrantSpecApplyConfiguration { return &ReferenceGrantSpecApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantto.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantto.go index c1e0ba760d..c417945775 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantto.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1/referencegrantto.go @@ -22,7 +22,7 @@ import ( v1 "sigs.k8s.io/gateway-api/apis/v1" ) -// ReferenceGrantToApplyConfiguration represents an declarative configuration of the ReferenceGrantTo type for use +// ReferenceGrantToApplyConfiguration represents a declarative configuration of the ReferenceGrantTo type for use // with apply. type ReferenceGrantToApplyConfiguration struct { Group *v1.Group `json:"group,omitempty"` @@ -30,7 +30,7 @@ type ReferenceGrantToApplyConfiguration struct { Name *v1.ObjectName `json:"name,omitempty"` } -// ReferenceGrantToApplyConfiguration constructs an declarative configuration of the ReferenceGrantTo type for use with +// ReferenceGrantToApplyConfiguration constructs a declarative configuration of the ReferenceGrantTo type for use with // apply. func ReferenceGrantTo() *ReferenceGrantToApplyConfiguration { return &ReferenceGrantToApplyConfiguration{} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/internal/internal.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/internal/internal.go index 21866f5425..07a0df71dd 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/internal/internal.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/internal/internal.go @@ -282,6 +282,16 @@ var schemaYAML = typed.YAMLObject(`types: - name: lifetimeType type: scalar: string +- name: io.k8s.sigs.gateway-api.apis.v1.Fraction + map: + fields: + - name: denominator + type: + scalar: numeric + - name: numerator + type: + scalar: numeric + default: 0 - name: io.k8s.sigs.gateway-api.apis.v1.FrontendTLSValidation map: fields: @@ -420,6 +430,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.sigs.gateway-api.apis.v1.GRPCRouteMatch elementRelationship: atomic + - name: name + type: + scalar: string - name: sessionPersistence type: namedType: io.k8s.sigs.gateway-api.apis.v1.SessionPersistence @@ -484,6 +497,12 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: io.k8s.sigs.gateway-api.apis.v1.GatewayBackendTLS + map: + fields: + - name: clientCertificateRef + type: + namedType: io.k8s.sigs.gateway-api.apis.v1.SecretObjectReference - name: io.k8s.sigs.gateway-api.apis.v1.GatewayClass map: fields: @@ -533,8 +552,10 @@ var schemaYAML = typed.YAMLObject(`types: type: list: elementType: - scalar: string + namedType: io.k8s.sigs.gateway-api.apis.v1.SupportedFeature elementRelationship: associative + keys: + - name - name: io.k8s.sigs.gateway-api.apis.v1.GatewayInfrastructure map: fields: @@ -560,6 +581,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.sigs.gateway-api.apis.v1.GatewayAddress elementRelationship: atomic + - name: backendTLS + type: + namedType: io.k8s.sigs.gateway-api.apis.v1.GatewayBackendTLS - name: gatewayClassName type: scalar: string @@ -751,6 +775,12 @@ var schemaYAML = typed.YAMLObject(`types: type: namedType: io.k8s.sigs.gateway-api.apis.v1.BackendObjectReference default: {} + - name: fraction + type: + namedType: io.k8s.sigs.gateway-api.apis.v1.Fraction + - name: percent + type: + scalar: numeric - name: io.k8s.sigs.gateway-api.apis.v1.HTTPRequestRedirectFilter map: fields: @@ -840,6 +870,21 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name +- name: io.k8s.sigs.gateway-api.apis.v1.HTTPRouteRetry + map: + fields: + - name: attempts + type: + scalar: numeric + - name: backoff + type: + scalar: string + - name: codes + type: + list: + elementType: + scalar: numeric + elementRelationship: atomic - name: io.k8s.sigs.gateway-api.apis.v1.HTTPRouteRule map: fields: @@ -861,6 +906,12 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.sigs.gateway-api.apis.v1.HTTPRouteMatch elementRelationship: atomic + - name: name + type: + scalar: string + - name: retry + type: + namedType: io.k8s.sigs.gateway-api.apis.v1.HTTPRouteRetry - name: sessionPersistence type: namedType: io.k8s.sigs.gateway-api.apis.v1.SessionPersistence @@ -1124,6 +1175,13 @@ var schemaYAML = typed.YAMLObject(`types: - name: type type: scalar: string +- name: io.k8s.sigs.gateway-api.apis.v1.SupportedFeature + map: + fields: + - name: name + type: + scalar: string + default: "" - name: io.k8s.sigs.gateway-api.apis.v1alpha2.BackendLBPolicy map: fields: @@ -1290,6 +1348,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.sigs.gateway-api.apis.v1.BackendRef elementRelationship: atomic + - name: name + type: + scalar: string - name: io.k8s.sigs.gateway-api.apis.v1alpha2.TCPRouteSpec map: fields: @@ -1344,6 +1405,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.sigs.gateway-api.apis.v1.BackendRef elementRelationship: atomic + - name: name + type: + scalar: string - name: io.k8s.sigs.gateway-api.apis.v1alpha2.TLSRouteSpec map: fields: @@ -1404,6 +1468,9 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.sigs.gateway-api.apis.v1.BackendRef elementRelationship: atomic + - name: name + type: + scalar: string - name: io.k8s.sigs.gateway-api.apis.v1alpha2.UDPRouteSpec map: fields: @@ -1452,6 +1519,11 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.sigs.gateway-api.apis.v1alpha3.BackendTLSPolicySpec map: fields: + - name: options + type: + map: + elementType: + scalar: string - name: targetRefs type: list: @@ -1475,9 +1547,28 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: subjectAltNames + type: + list: + elementType: + namedType: io.k8s.sigs.gateway-api.apis.v1alpha3.SubjectAltName + elementRelationship: atomic - name: wellKnownCACertificates type: scalar: string +- name: io.k8s.sigs.gateway-api.apis.v1alpha3.SubjectAltName + map: + fields: + - name: hostname + type: + scalar: string + - name: type + type: + scalar: string + default: "" + - name: uri + type: + scalar: string - name: io.k8s.sigs.gateway-api.apis.v1beta1.Gateway map: fields: diff --git a/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/utils.go b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/utils.go new file mode 100644 index 0000000000..debd0d9f68 --- /dev/null +++ b/vendor/sigs.k8s.io/gateway-api/apis/applyconfiguration/utils.go @@ -0,0 +1,234 @@ +/* +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 applyconfiguration-gen. DO NOT EDIT. + +package applyconfiguration + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + testing "k8s.io/client-go/testing" + apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" + apisv1alpha3 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3" + apisv1beta1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1" + internal "sigs.k8s.io/gateway-api/apis/applyconfiguration/internal" + v1 "sigs.k8s.io/gateway-api/apis/v1" + v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + v1alpha3 "sigs.k8s.io/gateway-api/apis/v1alpha3" + v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=gateway.networking.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithKind("AllowedRoutes"): + return &apisv1.AllowedRoutesApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("BackendObjectReference"): + return &apisv1.BackendObjectReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("BackendRef"): + return &apisv1.BackendRefApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("CommonRouteSpec"): + return &apisv1.CommonRouteSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("CookieConfig"): + return &apisv1.CookieConfigApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("Fraction"): + return &apisv1.FractionApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("FrontendTLSValidation"): + return &apisv1.FrontendTLSValidationApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("Gateway"): + return &apisv1.GatewayApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayAddress"): + return &apisv1.GatewayAddressApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayBackendTLS"): + return &apisv1.GatewayBackendTLSApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayClass"): + return &apisv1.GatewayClassApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayClassSpec"): + return &apisv1.GatewayClassSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayClassStatus"): + return &apisv1.GatewayClassStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayInfrastructure"): + return &apisv1.GatewayInfrastructureApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewaySpec"): + return &apisv1.GatewaySpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayStatus"): + return &apisv1.GatewayStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayStatusAddress"): + return &apisv1.GatewayStatusAddressApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GatewayTLSConfig"): + return &apisv1.GatewayTLSConfigApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCBackendRef"): + return &apisv1.GRPCBackendRefApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCHeaderMatch"): + return &apisv1.GRPCHeaderMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCMethodMatch"): + return &apisv1.GRPCMethodMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCRoute"): + return &apisv1.GRPCRouteApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCRouteFilter"): + return &apisv1.GRPCRouteFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCRouteMatch"): + return &apisv1.GRPCRouteMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCRouteRule"): + return &apisv1.GRPCRouteRuleApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCRouteSpec"): + return &apisv1.GRPCRouteSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GRPCRouteStatus"): + return &apisv1.GRPCRouteStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPBackendRef"): + return &apisv1.HTTPBackendRefApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPHeader"): + return &apisv1.HTTPHeaderApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPHeaderFilter"): + return &apisv1.HTTPHeaderFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPHeaderMatch"): + return &apisv1.HTTPHeaderMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPPathMatch"): + return &apisv1.HTTPPathMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPPathModifier"): + return &apisv1.HTTPPathModifierApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPQueryParamMatch"): + return &apisv1.HTTPQueryParamMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRequestMirrorFilter"): + return &apisv1.HTTPRequestMirrorFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRequestRedirectFilter"): + return &apisv1.HTTPRequestRedirectFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRoute"): + return &apisv1.HTTPRouteApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteFilter"): + return &apisv1.HTTPRouteFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteMatch"): + return &apisv1.HTTPRouteMatchApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteRetry"): + return &apisv1.HTTPRouteRetryApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteRule"): + return &apisv1.HTTPRouteRuleApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteSpec"): + return &apisv1.HTTPRouteSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteStatus"): + return &apisv1.HTTPRouteStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPRouteTimeouts"): + return &apisv1.HTTPRouteTimeoutsApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HTTPURLRewriteFilter"): + return &apisv1.HTTPURLRewriteFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("Listener"): + return &apisv1.ListenerApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ListenerStatus"): + return &apisv1.ListenerStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("LocalObjectReference"): + return &apisv1.LocalObjectReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("LocalParametersReference"): + return &apisv1.LocalParametersReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ObjectReference"): + return &apisv1.ObjectReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ParametersReference"): + return &apisv1.ParametersReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ParentReference"): + return &apisv1.ParentReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RouteGroupKind"): + return &apisv1.RouteGroupKindApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RouteNamespaces"): + return &apisv1.RouteNamespacesApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RouteParentStatus"): + return &apisv1.RouteParentStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RouteStatus"): + return &apisv1.RouteStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("SecretObjectReference"): + return &apisv1.SecretObjectReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("SessionPersistence"): + return &apisv1.SessionPersistenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("SupportedFeature"): + return &apisv1.SupportedFeatureApplyConfiguration{} + + // Group=gateway.networking.k8s.io, Version=v1alpha2 + case v1alpha2.SchemeGroupVersion.WithKind("BackendLBPolicy"): + return &apisv1alpha2.BackendLBPolicyApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("BackendLBPolicySpec"): + return &apisv1alpha2.BackendLBPolicySpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("GRPCRoute"): + return &apisv1alpha2.GRPCRouteApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("LocalPolicyTargetReference"): + return &apisv1alpha2.LocalPolicyTargetReferenceApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("LocalPolicyTargetReferenceWithSectionName"): + return &apisv1alpha2.LocalPolicyTargetReferenceWithSectionNameApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("PolicyAncestorStatus"): + return &apisv1alpha2.PolicyAncestorStatusApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("PolicyStatus"): + return &apisv1alpha2.PolicyStatusApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("ReferenceGrant"): + return &apisv1alpha2.ReferenceGrantApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TCPRoute"): + return &apisv1alpha2.TCPRouteApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TCPRouteRule"): + return &apisv1alpha2.TCPRouteRuleApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TCPRouteSpec"): + return &apisv1alpha2.TCPRouteSpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TCPRouteStatus"): + return &apisv1alpha2.TCPRouteStatusApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TLSRoute"): + return &apisv1alpha2.TLSRouteApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TLSRouteRule"): + return &apisv1alpha2.TLSRouteRuleApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TLSRouteSpec"): + return &apisv1alpha2.TLSRouteSpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("TLSRouteStatus"): + return &apisv1alpha2.TLSRouteStatusApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("UDPRoute"): + return &apisv1alpha2.UDPRouteApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("UDPRouteRule"): + return &apisv1alpha2.UDPRouteRuleApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("UDPRouteSpec"): + return &apisv1alpha2.UDPRouteSpecApplyConfiguration{} + case v1alpha2.SchemeGroupVersion.WithKind("UDPRouteStatus"): + return &apisv1alpha2.UDPRouteStatusApplyConfiguration{} + + // Group=gateway.networking.k8s.io, Version=v1alpha3 + case v1alpha3.SchemeGroupVersion.WithKind("BackendTLSPolicy"): + return &apisv1alpha3.BackendTLSPolicyApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("BackendTLSPolicySpec"): + return &apisv1alpha3.BackendTLSPolicySpecApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("BackendTLSPolicyValidation"): + return &apisv1alpha3.BackendTLSPolicyValidationApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("SubjectAltName"): + return &apisv1alpha3.SubjectAltNameApplyConfiguration{} + + // Group=gateway.networking.k8s.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithKind("Gateway"): + return &apisv1beta1.GatewayApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("GatewayClass"): + return &apisv1beta1.GatewayClassApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("HTTPRoute"): + return &apisv1beta1.HTTPRouteApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ReferenceGrant"): + return &apisv1beta1.ReferenceGrantApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ReferenceGrantFrom"): + return &apisv1beta1.ReferenceGrantFromApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ReferenceGrantSpec"): + return &apisv1beta1.ReferenceGrantSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ReferenceGrantTo"): + return &apisv1beta1.ReferenceGrantToApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) *testing.TypeConverter { + return &testing.TypeConverter{Scheme: scheme, TypeResolver: internal.Parser()} +} 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 index caa5e96bf3..5211f5a3cb 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1/gateway_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/gateway_types.go @@ -224,11 +224,19 @@ type GatewaySpec struct { // Infrastructure defines infrastructure level attributes about this Gateway instance. // - // Support: Core + // Support: Extended // - // // +optional Infrastructure *GatewayInfrastructure `json:"infrastructure,omitempty"` + + // BackendTLS configures TLS settings for when this Gateway is connecting to + // backends with TLS. + // + // Support: Core + // + // +optional + // + BackendTLS *GatewayBackendTLS `json:"backendTLS,omitempty"` } // Listener embodies the concept of a logical endpoint where a Gateway accepts @@ -351,7 +359,7 @@ 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]+$` +// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([-a-zA-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 ( @@ -374,6 +382,29 @@ const ( UDPProtocolType ProtocolType = "UDP" ) +// GatewayBackendTLS describes backend TLS configuration for gateway. +type GatewayBackendTLS struct { + // ClientCertificateRef is a reference to an object that contains a Client + // Certificate and the associated private key. + // + // 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. + // + // ClientCertificateRef can reference to standard Kubernetes resources, i.e. + // Secret, or implementation-specific custom resources. + // + // This setting can be overridden on the service level by use of BackendTLSPolicy. + // + // Support: Core + // + // +optional + // + ClientCertificateRef *SecretObjectReference `json:"clientCertificateRef,omitempty"` +} + // GatewayTLSConfig describes a TLS configuration. // // +kubebuilder:validation:XValidation:message="certificateRefs or options must be specified when mode is Terminate",rule="self.mode == 'Terminate' ? size(self.certificateRefs) > 0 || size(self.options) > 0 : true" @@ -679,11 +710,16 @@ type GatewayInfrastructure struct { // // An implementation may chose to add additional implementation-specific labels as they see fit. // + // If an implementation maps these labels to Pods, or any other resource that would need to be recreated when labels + // change, it SHOULD clearly warn about this behavior in documentation. + // // Support: Extended // // +optional // +kubebuilder:validation:MaxProperties=8 - Labels map[AnnotationKey]AnnotationValue `json:"labels,omitempty"` + // +kubebuilder:validation:XValidation:message="Label keys must be in the form of an optional DNS subdomain prefix followed by a required name segment of up to 63 characters.",rule="self.all(key, key.matches(r\"\"\"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$\"\"\"))" + // +kubebuilder:validation:XValidation:message="If specified, the label key's prefix must be a DNS subdomain not longer than 253 characters in total.",rule="self.all(key, key.split(\"/\")[0].size() < 253)" + Labels map[LabelKey]LabelValue `json:"labels,omitempty"` // Annotations that SHOULD be applied to any resources created in response to this Gateway. // @@ -696,6 +732,8 @@ type GatewayInfrastructure struct { // // +optional // +kubebuilder:validation:MaxProperties=8 + // +kubebuilder:validation:XValidation:message="Annotation keys must be in the form of an optional DNS subdomain prefix followed by a required name segment of up to 63 characters.",rule="self.all(key, key.matches(r\"\"\"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$\"\"\"))" + // +kubebuilder:validation:XValidation:message="If specified, the annotation key's prefix must be a DNS subdomain not longer than 253 characters in total.",rule="self.all(key, key.split(\"/\")[0].size() < 253)" Annotations map[AnnotationKey]AnnotationValue `json:"annotations,omitempty"` // ParametersRef is a reference to a resource that contains the configuration 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 index 21875dce19..9aeaddfa0b 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1/gatewayclass_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/gatewayclass_types.go @@ -60,7 +60,7 @@ type GatewayClass struct { // 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"}}} + // +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Pending", lastTransitionTime: "1970-01-01T00:00:00Z"}}} Status GatewayClassStatus `json:"status,omitempty"` } @@ -93,8 +93,10 @@ type GatewayClassSpec struct { // 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. + // If the referent cannot be found, refers to an unsupported kind, or when + // the data within that resource is malformed, the GatewayClass SHOULD be + // rejected with the "Accepted" status condition set to "False" and an + // "InvalidParameters" reason. // // A Gateway for this GatewayClass may provide its own `parametersRef`. When both are specified, // the merging behavior is implementation specific. @@ -162,6 +164,7 @@ const ( // Possible reasons for this condition to be False are: // // * "InvalidParameters" + // * "Unsupported" // * "UnsupportedVersion" // // Possible reasons for this condition to be Unknown are: @@ -176,9 +179,10 @@ const ( // 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. + // This reason is used with the "Accepted" condition when the GatewayClass + // was not accepted because the parametersRef field refers to a nonexistent + // or unsupported resource or kind, or when the data within that resource is + // malformed. GatewayClassReasonInvalidParameters GatewayClassConditionReason = "InvalidParameters" // This reason is used with the "Accepted" condition when the @@ -187,6 +191,11 @@ const ( // GatewayClass. GatewayClassReasonPending GatewayClassConditionReason = "Pending" + // This reason is used with the "Accepted" condition when the GatewayClass + // was not accepted because the implementation does not support a + // user-defined GatewayClass. + GatewayClassReasonUnsupported GatewayClassConditionReason = "Unsupported" + // Deprecated: Use "Pending" instead. GatewayClassReasonWaiting GatewayClassConditionReason = "Waiting" ) @@ -252,9 +261,10 @@ type GatewayClassStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` // SupportedFeatures is the set of features the GatewayClass support. - // It MUST be sorted in ascending alphabetical order. + // It MUST be sorted in ascending alphabetical order by the Name key. // +optional - // +listType=set + // +listType=map + // +listMapKey=name // // +kubebuilder:validation:MaxItems=64 SupportedFeatures []SupportedFeature `json:"supportedFeatures,omitempty"` @@ -269,6 +279,10 @@ type GatewayClassList struct { Items []GatewayClass `json:"items"` } -// SupportedFeature is used to describe distinct features that are covered by +// FeatureName is used to describe distinct features that are covered by // conformance tests. -type SupportedFeature string +type FeatureName string + +type SupportedFeature struct { + Name FeatureName `json:"name"` +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1/grpcroute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1/grpcroute_types.go index 91a8a3d268..953ba0243b 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1/grpcroute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/grpcroute_types.go @@ -143,6 +143,8 @@ type GRPCRouteSpec struct { // // +optional // +kubebuilder:validation:MaxItems=16 + // +kubebuilder:validation:XValidation:message="While 16 rules and 64 matches per rule are allowed, the total number of matches across all rules in a route must be less than 128",rule="(self.size() > 0 ? (has(self[0].matches) ? self[0].matches.size() : 0) : 0) + (self.size() > 1 ? (has(self[1].matches) ? self[1].matches.size() : 0) : 0) + (self.size() > 2 ? (has(self[2].matches) ? self[2].matches.size() : 0) : 0) + (self.size() > 3 ? (has(self[3].matches) ? self[3].matches.size() : 0) : 0) + (self.size() > 4 ? (has(self[4].matches) ? self[4].matches.size() : 0) : 0) + (self.size() > 5 ? (has(self[5].matches) ? self[5].matches.size() : 0) : 0) + (self.size() > 6 ? (has(self[6].matches) ? self[6].matches.size() : 0) : 0) + (self.size() > 7 ? (has(self[7].matches) ? self[7].matches.size() : 0) : 0) + (self.size() > 8 ? (has(self[8].matches) ? self[8].matches.size() : 0) : 0) + (self.size() > 9 ? (has(self[9].matches) ? self[9].matches.size() : 0) : 0) + (self.size() > 10 ? (has(self[10].matches) ? self[10].matches.size() : 0) : 0) + (self.size() > 11 ? (has(self[11].matches) ? self[11].matches.size() : 0) : 0) + (self.size() > 12 ? (has(self[12].matches) ? self[12].matches.size() : 0) : 0) + (self.size() > 13 ? (has(self[13].matches) ? self[13].matches.size() : 0) : 0) + (self.size() > 14 ? (has(self[14].matches) ? self[14].matches.size() : 0) : 0) + (self.size() > 15 ? (has(self[15].matches) ? self[15].matches.size() : 0) : 0) <= 128" + // Rules []GRPCRouteRule `json:"rules,omitempty"` } @@ -150,6 +152,13 @@ type GRPCRouteSpec struct { // conditions (matches), processing it (filters), and forwarding the request to // an API object (backendRefs). type GRPCRouteRule struct { + // Name is the name of the route rule. This name MUST be unique within a Route if it is set. + // + // Support: Extended + // +optional + // + Name *SectionName `json:"name,omitempty"` + // Matches define conditions used for matching the rule against incoming // gRPC requests. Each match is independent, i.e. this rule will be matched // if **any** one of the matches is satisfied. @@ -387,7 +396,7 @@ type GRPCHeaderMatch struct { // // +optional // +kubebuilder:default=Exact - Type *HeaderMatchType `json:"type,omitempty"` + Type *GRPCHeaderMatchType `json:"type,omitempty"` // Name is the name of the gRPC Header to be matched. // @@ -541,6 +550,8 @@ type GRPCRouteFilter struct { // Support: Extended // // +optional + // + // RequestMirror *HTTPRequestMirrorFilter `json:"requestMirror,omitempty"` // ExtensionRef is an optional, implementation-specific extension to the 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 index 736e80982a..3322c68eac 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1/httproute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/httproute_types.go @@ -117,8 +117,10 @@ type HTTPRouteSpec struct { // Rules are a list of HTTP matchers, filters and actions. // // +optional + // // +kubebuilder:validation:MaxItems=16 // +kubebuilder:default={{matches: {{path: {type: "PathPrefix", value: "/"}}}}} + // +kubebuilder:validation:XValidation:message="While 16 rules and 64 matches per rule are allowed, the total number of matches across all rules in a route must be less than 128",rule="(self.size() > 0 ? self[0].matches.size() : 0) + (self.size() > 1 ? self[1].matches.size() : 0) + (self.size() > 2 ? self[2].matches.size() : 0) + (self.size() > 3 ? self[3].matches.size() : 0) + (self.size() > 4 ? self[4].matches.size() : 0) + (self.size() > 5 ? self[5].matches.size() : 0) + (self.size() > 6 ? self[6].matches.size() : 0) + (self.size() > 7 ? self[7].matches.size() : 0) + (self.size() > 8 ? self[8].matches.size() : 0) + (self.size() > 9 ? self[9].matches.size() : 0) + (self.size() > 10 ? self[10].matches.size() : 0) + (self.size() > 11 ? self[11].matches.size() : 0) + (self.size() > 12 ? self[12].matches.size() : 0) + (self.size() > 13 ? self[13].matches.size() : 0) + (self.size() > 14 ? self[14].matches.size() : 0) + (self.size() > 15 ? self[15].matches.size() : 0) <= 128" Rules []HTTPRouteRule `json:"rules,omitempty"` } @@ -132,6 +134,13 @@ type HTTPRouteSpec struct { // +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 { + // Name is the name of the route rule. This name MUST be unique within a Route if it is set. + // + // Support: Extended + // +optional + // + Name *SectionName `json:"name,omitempty"` + // 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. @@ -190,7 +199,7 @@ type HTTPRouteRule struct { // parent a request is coming from, a HTTP 404 status code MUST be returned. // // +optional - // +kubebuilder:validation:MaxItems=8 + // +kubebuilder:validation:MaxItems=64 // +kubebuilder:default={{path:{ type: "PathPrefix", value: "/"}}} Matches []HTTPRouteMatch `json:"matches,omitempty"` @@ -263,6 +272,11 @@ type HTTPRouteRule struct { // invalid, 50 percent of traffic must receive a 500. Implementations may // choose how that 50 percent is determined. // + // When a HTTPBackendRef refers to a Service that has no ready endpoints, + // implementations SHOULD return a 503 for requests to that backend instead. + // If an implementation chooses to do this, all of the above rules for 500 responses + // MUST also apply for responses that return a 503. + // // Support: Core for Kubernetes Service // // Support: Extended for Kubernetes ServiceImport @@ -280,9 +294,16 @@ type HTTPRouteRule struct { // Support: Extended // // +optional - // Timeouts *HTTPRouteTimeouts `json:"timeouts,omitempty"` + // Retry defines the configuration for when to retry an HTTP request. + // + // Support: Extended + // + // +optional + // + Retry *HTTPRouteRetry `json:"retry,omitempty"` + // SessionPersistence defines and configures session persistence // for the route rule. // @@ -316,7 +337,8 @@ type HTTPRouteTimeouts struct { // 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. + // The value of Request is a Gateway API Duration string as defined by GEP-2257. When this + // field is unspecified, request timeout behavior is implementation-specific. // // Support: Extended // @@ -336,8 +358,10 @@ type HTTPRouteTimeouts struct { // 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. + // The value of BackendRequest must be a Gateway API Duration string as defined by + // GEP-2257. When this field is unspecified, its behavior is implementation-specific; + // when specified, the value of BackendRequest must be no more than the value of the + // Request timeout (since the Request timeout encompasses the BackendRequest timeout). // // Support: Extended // @@ -345,6 +369,95 @@ type HTTPRouteTimeouts struct { BackendRequest *Duration `json:"backendRequest,omitempty"` } +// HTTPRouteRetry defines retry configuration for an HTTPRoute. +// +// Implementations SHOULD retry on connection errors (disconnect, reset, timeout, +// TCP failure) if a retry stanza is configured. +type HTTPRouteRetry struct { + // Codes defines the HTTP response status codes for which a backend request + // should be retried. + // + // Support: Extended + // + // +optional + Codes []HTTPRouteRetryStatusCode `json:"codes,omitempty"` + + // Attempts specifies the maxmimum number of times an individual request + // from the gateway to a backend should be retried. + // + // If the maximum number of retries has been attempted without a successful + // response from the backend, the Gateway MUST return an error. + // + // When this field is unspecified, the number of times to attempt to retry + // a backend request is implementation-specific. + // + // Support: Extended + // + // +optional + Attempts *int `json:"attempts,omitempty"` + + // Backoff specifies the minimum duration a Gateway should wait between + // retry attempts and is represented in Gateway API Duration formatting. + // + // For example, setting the `rules[].retry.backoff` field to the value + // `100ms` will cause a backend request to first be retried approximately + // 100 milliseconds after timing out or receiving a response code configured + // to be retryable. + // + // An implementation MAY use an exponential or alternative backoff strategy + // for subsequent retry attempts, MAY cap the maximum backoff duration to + // some amount greater than the specified minimum, and MAY add arbitrary + // jitter to stagger requests, as long as unsuccessful backend requests are + // not retried before the configured minimum duration. + // + // If a Request timeout (`rules[].timeouts.request`) is configured on the + // route, the entire duration of the initial request and any retry attempts + // MUST not exceed the Request timeout duration. If any retry attempts are + // still in progress when the Request timeout duration has been reached, + // these SHOULD be canceled if possible and the Gateway MUST immediately + // return a timeout error. + // + // If a BackendRequest timeout (`rules[].timeouts.backendRequest`) is + // configured on the route, any retry attempts which reach the configured + // BackendRequest timeout duration without a response SHOULD be canceled if + // possible and the Gateway should wait for at least the specified backoff + // duration before attempting to retry the backend request again. + // + // If a BackendRequest timeout is _not_ configured on the route, retry + // attempts MAY time out after an implementation default duration, or MAY + // remain pending until a configured Request timeout or implementation + // default duration for total request time is reached. + // + // When this field is unspecified, the time to wait between retry attempts + // is implementation-specific. + // + // Support: Extended + // + // +optional + Backoff *Duration `json:"backoff,omitempty"` +} + +// HTTPRouteRetryStatusCode defines an HTTP response status code for +// which a backend request should be retried. +// +// Implementations MUST support the following status codes as retryable: +// +// * 500 +// * 502 +// * 503 +// * 504 +// +// Implementations MAY support specifying additional discrete values in the +// 500-599 range. +// +// Implementations MAY support specifying discrete values in the 400-499 range, +// which are often inadvisable to retry. +// +// +kubebuilder:validation:Minimum:=400 +// +kubebuilder:validation:Maximum:=599 +// +type HTTPRouteRetryStatusCode int + // PathMatchType specifies the semantics of how HTTP paths should be compared. // Valid PathMatchType values, along with their support levels, are: // @@ -741,6 +854,8 @@ type HTTPRouteFilter struct { // Support: Extended // // +optional + // + // RequestMirror *HTTPRequestMirrorFilter `json:"requestMirror,omitempty"` // RequestRedirect defines a schema for a filter that responds to the @@ -1137,6 +1252,29 @@ type HTTPRequestMirrorFilter struct { // // Support: Implementation-specific for any other resource BackendRef BackendObjectReference `json:"backendRef"` + + // Percent represents the percentage of requests that should be + // mirrored to BackendRef. Its minimum value is 0 (indicating 0% of + // requests) and its maximum value is 100 (indicating 100% of requests). + // + // Only one of Fraction or Percent may be specified. If neither field + // is specified, 100% of requests will be mirrored. + // + // +optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=100 + // + Percent *int32 `json:"percent,omitempty"` + + // Fraction represents the fraction of requests that should be + // mirrored to BackendRef. + // + // Only one of Fraction or Percent may be specified. If neither field + // is specified, 100% of requests will be mirrored. + // + // +optional + // + Fraction *Fraction `json:"fraction,omitempty"` } // HTTPBackendRef defines how a HTTPRoute forwards a HTTP request. 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 index bed2cc8b8e..8349636956 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1/shared_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1/shared_types.go @@ -535,6 +535,19 @@ type Hostname string // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` type PreciseHostname string +// AbsoluteURI represents a Uniform Resource Identifier (URI) as defined by RFC3986. + +// The AbsoluteURI MUST NOT be a relative URI, and it MUST follow the URI syntax and +// encoding rules specified in RFC3986. The AbsoluteURI MUST include both a +// scheme (e.g., "http" or "spiffe") and a scheme-specific-part. URIs that +// include an authority MUST include a fully qualified domain name or +// IP address as the host. + +// +kubebuilder:validation:MinLength=1 +// +kubebuilder:validation:MaxLength=253 +// +kubebuilder:validation:Pattern=`^(([^:/?#]+):)(//([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?` +type AbsoluteURI string + // Group refers to a Kubernetes Group. It must either be an empty string or a // RFC 1123 subdomain. // @@ -666,7 +679,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]/?)*$` +// +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][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$` type AnnotationKey string // AnnotationValue is the value of an annotation in Gateway API. This is used @@ -678,6 +691,45 @@ type AnnotationKey string // +kubebuilder:validation:MaxLength=4096 type AnnotationValue string +// LabelKey is the key of a label in the Gateway API. This is used for validation +// of maps such as Gateway infrastructure labels. This matches the Kubernetes +// "qualified name" validation that is used for labels. +// +// 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-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$` +type LabelKey string + +// LabelValue is the value of a label in the Gateway API. This is used for validation +// of maps such as Gateway infrastructure labels. This matches the Kubernetes +// label validation rules: +// * must be 63 characters or less (can be empty), +// * unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]), +// * could contain dashes (-), underscores (_), dots (.), and alphanumerics between. +// +// Valid values include: +// +// * MyValue +// * my.name +// * 123-my-value +// +// +kubebuilder:validation:MinLength=0 +// +kubebuilder:validation:MaxLength=63 +// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$` +type LabelValue string + // AddressType defines how a network address is represented as a text string. // This may take two possible forms: // @@ -745,7 +797,7 @@ const ( ) // SessionPersistence defines the desired state of SessionPersistence. -// +kubebuilder:validation:XValidation:message="AbsoluteTimeout must be specified when cookie lifetimeType is Permanent",rule="!has(self.cookieConfig.lifetimeType) || self.cookieConfig.lifetimeType != 'Permanent' || has(self.absoluteTimeout)" +// +kubebuilder:validation:XValidation:message="AbsoluteTimeout must be specified when cookie lifetimeType is Permanent",rule="!has(self.cookieConfig) || !has(self.cookieConfig.lifetimeType) || self.cookieConfig.lifetimeType != 'Permanent' || has(self.absoluteTimeout)" type SessionPersistence struct { // SessionName defines the name of the persistent session token // which may be reflected in the cookie or the header. Users @@ -855,3 +907,14 @@ const ( // Support: Extended PermanentCookieLifetimeType CookieLifetimeType = "Permanent" ) + +// +kubebuilder:validation:XValidation:message="numerator must be less than or equal to denominator",rule="self.numerator <= self.denominator" +type Fraction struct { + // +kubebuilder:validation:Minimum=0 + Numerator int32 `json:"numerator"` + + // +optional + // +kubebuilder:default=100 + // +kubebuilder:validation:Minimum=1 + Denominator *int32 `json:"denominator,omitempty"` +} 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 index ddb9bb9d49..62fb99b0d5 100644 --- 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 @@ -150,6 +150,26 @@ func (in *CookieConfig) DeepCopy() *CookieConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Fraction) DeepCopyInto(out *Fraction) { + *out = *in + if in.Denominator != nil { + in, out := &in.Denominator, &out.Denominator + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Fraction. +func (in *Fraction) DeepCopy() *Fraction { + if in == nil { + return nil + } + out := new(Fraction) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FrontendTLSValidation) DeepCopyInto(out *FrontendTLSValidation) { *out = *in @@ -200,7 +220,7 @@ func (in *GRPCHeaderMatch) DeepCopyInto(out *GRPCHeaderMatch) { *out = *in if in.Type != nil { in, out := &in.Type, &out.Type - *out = new(HeaderMatchType) + *out = new(GRPCHeaderMatchType) **out = **in } } @@ -369,6 +389,11 @@ func (in *GRPCRouteMatch) DeepCopy() *GRPCRouteMatch { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GRPCRouteRule) DeepCopyInto(out *GRPCRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SectionName) + **out = **in + } if in.Matches != nil { in, out := &in.Matches, &out.Matches *out = make([]GRPCRouteMatch, len(*in)) @@ -498,6 +523,26 @@ func (in *GatewayAddress) DeepCopy() *GatewayAddress { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GatewayBackendTLS) DeepCopyInto(out *GatewayBackendTLS) { + *out = *in + if in.ClientCertificateRef != nil { + in, out := &in.ClientCertificateRef, &out.ClientCertificateRef + *out = new(SecretObjectReference) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayBackendTLS. +func (in *GatewayBackendTLS) DeepCopy() *GatewayBackendTLS { + if in == nil { + return nil + } + out := new(GatewayBackendTLS) + 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 @@ -614,7 +659,7 @@ 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)) + *out = make(map[LabelKey]LabelValue, len(*in)) for key, val := range *in { (*out)[key] = val } @@ -697,6 +742,11 @@ func (in *GatewaySpec) DeepCopyInto(out *GatewaySpec) { *out = new(GatewayInfrastructure) (*in).DeepCopyInto(*out) } + if in.BackendTLS != nil { + in, out := &in.BackendTLS, &out.BackendTLS + *out = new(GatewayBackendTLS) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewaySpec. @@ -966,6 +1016,16 @@ func (in *HTTPQueryParamMatch) DeepCopy() *HTTPQueryParamMatch { func (in *HTTPRequestMirrorFilter) DeepCopyInto(out *HTTPRequestMirrorFilter) { *out = *in in.BackendRef.DeepCopyInto(&out.BackendRef) + if in.Percent != nil { + in, out := &in.Percent, &out.Percent + *out = new(int32) + **out = **in + } + if in.Fraction != nil { + in, out := &in.Fraction, &out.Fraction + *out = new(Fraction) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRequestMirrorFilter. @@ -1161,9 +1221,44 @@ func (in *HTTPRouteMatch) DeepCopy() *HTTPRouteMatch { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPRouteRetry) DeepCopyInto(out *HTTPRouteRetry) { + *out = *in + if in.Codes != nil { + in, out := &in.Codes, &out.Codes + *out = make([]HTTPRouteRetryStatusCode, len(*in)) + copy(*out, *in) + } + if in.Attempts != nil { + in, out := &in.Attempts, &out.Attempts + *out = new(int) + **out = **in + } + if in.Backoff != nil { + in, out := &in.Backoff, &out.Backoff + *out = new(Duration) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteRetry. +func (in *HTTPRouteRetry) DeepCopy() *HTTPRouteRetry { + if in == nil { + return nil + } + out := new(HTTPRouteRetry) + 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.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SectionName) + **out = **in + } if in.Matches != nil { in, out := &in.Matches, &out.Matches *out = make([]HTTPRouteMatch, len(*in)) @@ -1190,6 +1285,11 @@ func (in *HTTPRouteRule) DeepCopyInto(out *HTTPRouteRule) { *out = new(HTTPRouteTimeouts) (*in).DeepCopyInto(*out) } + if in.Retry != nil { + in, out := &in.Retry, &out.Retry + *out = new(HTTPRouteRetry) + (*in).DeepCopyInto(*out) + } if in.SessionPersistence != nil { in, out := &in.SessionPersistence, &out.SessionPersistence *out = new(SessionPersistence) @@ -1629,3 +1729,18 @@ func (in *SessionPersistence) DeepCopy() *SessionPersistence { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SupportedFeature) DeepCopyInto(out *SupportedFeature) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SupportedFeature. +func (in *SupportedFeature) DeepCopy() *SupportedFeature { + if in == nil { + return nil + } + out := new(SupportedFeature) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendlbpolicy_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendlbpolicy_types.go index f6cc9741ec..83cd69a061 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendlbpolicy_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/backendlbpolicy_types.go @@ -26,6 +26,9 @@ import ( // +kubebuilder:storageversion // +kubebuilder:resource:categories=gateway-api,shortName=blbpolicy // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +// BackendLBPolicy is a Direct Attached Policy. +// +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=Direct" // BackendLBPolicy provides a way to define load balancing rules // for a backend. 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 0b0bb4e85a..0750c2cb6b 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 @@ -24,6 +24,7 @@ import ( // +genclient // +kubebuilder:object:root=true +// +kubebuilder:skipversion // +kubebuilder:deprecatedversion:warning="The v1alpha2 version of GRPCRoute has been deprecated and will be removed in a future release of the API. Please upgrade to v1." type GRPCRoute v1.GRPCRoute diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/referencegrant_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/referencegrant_types.go index d673062608..372022f77c 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/referencegrant_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/referencegrant_types.go @@ -26,6 +26,7 @@ import ( // +kubebuilder:object:root=true // +kubebuilder:resource:categories=gateway-api,shortName=refgrant // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +kubebuilder:skipversion // +kubebuilder:deprecatedversion:warning="The v1alpha2 version of ReferenceGrant has been deprecated and will be removed in a future release of the API. Please upgrade to v1beta1." // ReferenceGrant identifies kinds of resources in other namespaces that are diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tcproute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tcproute_types.go index fe927ab8d4..b79253dd33 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tcproute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tcproute_types.go @@ -49,6 +49,7 @@ type TCPRouteSpec struct { // // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 + // Rules []TCPRouteRule `json:"rules"` } @@ -59,6 +60,12 @@ type TCPRouteStatus struct { // TCPRouteRule is the configuration for a given rule. type TCPRouteRule struct { + // Name is the name of the route rule. This name MUST be unique within a Route if it is set. + // + // Support: Extended + // +optional + Name *SectionName `json:"name,omitempty"` + // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or a // Service with no endpoints), the underlying implementation MUST actively diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tlsroute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tlsroute_types.go index afe34d82d6..26dfde77c7 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tlsroute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/tlsroute_types.go @@ -90,6 +90,7 @@ type TLSRouteSpec struct { // // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 + // Rules []TLSRouteRule `json:"rules"` } @@ -100,6 +101,12 @@ type TLSRouteStatus struct { // TLSRouteRule is the configuration for a given rule. type TLSRouteRule struct { + // Name is the name of the route rule. This name MUST be unique within a Route if it is set. + // + // Support: Extended + // +optional + Name *SectionName `json:"name,omitempty"` + // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or // a Service with no endpoints), the rule performs no forwarding; if no diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/udproute_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/udproute_types.go index 9e3770c293..9e7fe3ff80 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/udproute_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha2/udproute_types.go @@ -49,6 +49,7 @@ type UDPRouteSpec struct { // // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 + // Rules []UDPRouteRule `json:"rules"` } @@ -59,6 +60,12 @@ type UDPRouteStatus struct { // UDPRouteRule is the configuration for a given rule. type UDPRouteRule struct { + // Name is the name of the route rule. This name MUST be unique within a Route if it is set. + // + // Support: Extended + // +optional + Name *SectionName `json:"name,omitempty"` + // BackendRefs defines the backend(s) where matching requests should be // sent. If unspecified or invalid (refers to a non-existent resource or a // Service with no endpoints), the underlying implementation MUST actively 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 3bf9f0fbe6..5306ca135d 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 @@ -390,6 +390,11 @@ func (in *TCPRouteList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TCPRouteRule) DeepCopyInto(out *TCPRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.SectionName) + **out = **in + } if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs *out = make([]v1.BackendRef, len(*in)) @@ -510,6 +515,11 @@ func (in *TLSRouteList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLSRouteRule) DeepCopyInto(out *TLSRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.SectionName) + **out = **in + } if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs *out = make([]v1.BackendRef, len(*in)) @@ -635,6 +645,11 @@ func (in *UDPRouteList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UDPRouteRule) DeepCopyInto(out *UDPRouteRule) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(v1.SectionName) + **out = **in + } if in.BackendRefs != nil { in, out := &in.BackendRefs, &out.BackendRefs *out = make([]v1.BackendRef, len(*in)) diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/backendtlspolicy_types.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/backendtlspolicy_types.go index cafd1a7ff3..83f3b2df26 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/backendtlspolicy_types.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/backendtlspolicy_types.go @@ -75,6 +75,21 @@ type BackendTLSPolicySpec struct { // Validation contains backend TLS validation configuration. Validation BackendTLSPolicyValidation `json:"validation"` + + // 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[v1.AnnotationKey]v1.AnnotationValue `json:"options,omitempty"` } // BackendTLSPolicyValidation contains backend TLS validation configuration. @@ -126,11 +141,52 @@ type BackendTLSPolicyValidation struct { // 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. + // 2. If SubjectAltNames is not specified, Hostname MUST be used for + // authentication and MUST match the certificate served by the matching + // backend. // // Support: Core Hostname v1.PreciseHostname `json:"hostname"` + + // SubjectAltNames contains one or more Subject Alternative Names. + // When specified, the certificate served from the backend MUST have at least one + // Subject Alternate Name matching one of the specified SubjectAltNames. + // + // Support: Core + // + // +optional + // +kubebuilder:validation:MaxItems=5 + SubjectAltNames []SubjectAltName `json:"subjectAltNames,omitempty"` +} + +// SubjectAltName represents Subject Alternative Name. +// +kubebuilder:validation:XValidation:message="SubjectAltName element must contain Hostname, if Type is set to Hostname",rule="!(self.type == \"Hostname\" && (!has(self.hostname) || self.hostname == \"\"))" +// +kubebuilder:validation:XValidation:message="SubjectAltName element must not contain Hostname, if Type is not set to Hostname",rule="!(self.type != \"Hostname\" && has(self.hostname) && self.hostname != \"\")" +// +kubebuilder:validation:XValidation:message="SubjectAltName element must contain URI, if Type is set to URI",rule="!(self.type == \"URI\" && (!has(self.uri) || self.uri == \"\"))" +// +kubebuilder:validation:XValidation:message="SubjectAltName element must not contain URI, if Type is not set to URI",rule="!(self.type != \"URI\" && has(self.uri) && self.uri != \"\")" +type SubjectAltName struct { + // Type determines the format of the Subject Alternative Name. Always required. + // + // Support: Core + Type SubjectAltNameType `json:"type"` + + // Hostname contains Subject Alternative Name specified in DNS name format. + // Required when Type is set to Hostname, ignored otherwise. + // + // Support: Core + // + // +optional + Hostname v1.Hostname `json:"hostname,omitempty"` + + // URI contains Subject Alternative Name specified in a full URI format. + // It MUST include both a scheme (e.g., "http" or "ftp") and a scheme-specific-part. + // Common values include SPIFFE IDs like "spiffe://mycluster.example.com/ns/myns/sa/svc1sa". + // Required when Type is set to URI, ignored otherwise. + // + // Support: Core + // + // +optional + URI v1.AbsoluteURI `json:"uri,omitempty"` } // WellKnownCACertificatesType is the type of CA certificate that will be used @@ -142,3 +198,19 @@ const ( // WellKnownCACertificatesSystem indicates that well known system CA certificates should be used. WellKnownCACertificatesSystem WellKnownCACertificatesType = "System" ) + +// SubjectAltNameType is the type of the Subject Alternative Name. +// +kubebuilder:validation:Enum=Hostname;URI +type SubjectAltNameType string + +const ( + // HostnameSubjectAltNameType specifies hostname-based SAN. + // + // Support: Core + HostnameSubjectAltNameType SubjectAltNameType = "Hostname" + + // URISubjectAltNameType specifies URI-based SAN, e.g. SPIFFE id. + // + // Support: Core + URISubjectAltNameType SubjectAltNameType = "URI" +) diff --git a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/zz_generated.deepcopy.go index 5339c534c9..876ac9f7b6 100644 --- a/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/zz_generated.deepcopy.go +++ b/vendor/sigs.k8s.io/gateway-api/apis/v1alpha3/zz_generated.deepcopy.go @@ -96,6 +96,13 @@ func (in *BackendTLSPolicySpec) DeepCopyInto(out *BackendTLSPolicySpec) { } } in.Validation.DeepCopyInto(&out.Validation) + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make(map[v1.AnnotationKey]v1.AnnotationValue, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSPolicySpec. @@ -121,6 +128,11 @@ func (in *BackendTLSPolicyValidation) DeepCopyInto(out *BackendTLSPolicyValidati *out = new(WellKnownCACertificatesType) **out = **in } + if in.SubjectAltNames != nil { + in, out := &in.SubjectAltNames, &out.SubjectAltNames + *out = make([]SubjectAltName, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendTLSPolicyValidation. @@ -132,3 +144,18 @@ func (in *BackendTLSPolicyValidation) DeepCopy() *BackendTLSPolicyValidation { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubjectAltName) DeepCopyInto(out *SubjectAltName) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubjectAltName. +func (in *SubjectAltName) DeepCopy() *SubjectAltName { + if in == nil { + return nil + } + out := new(SubjectAltName) + in.DeepCopyInto(out) + return out +} 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 25ab2560d8..81c7e228c1 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 @@ -111,7 +111,7 @@ type HeaderMatchType = v1.HeaderMatchType // // * "/invalid" - "/" is an invalid character // +k8s:deepcopy-gen=false -type HTTPHeaderName = v1.HeaderName +type HTTPHeaderName = v1.HTTPHeaderName // HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request // headers. 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 c588377449..7d165c93ba 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 @@ -24,6 +24,7 @@ import ( "k8s.io/client-go/discovery" fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" + applyconfiguration "sigs.k8s.io/gateway-api/apis/applyconfiguration" 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" @@ -37,8 +38,12 @@ import ( // NewSimpleClientset returns a clientset that will respond with the provided objects. // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any validations and/or defaults. It shouldn't be considered a replacement +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves +// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. +// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -80,6 +85,38 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } +// NewClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfiguration.NewTypeConverter(scheme), + ) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + var ( _ clientset.Interface = &Clientset{} _ testing.FakeClient = &Clientset{} 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 index 589461d4ce..38b4ec9ca9 100644 --- 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 @@ -44,22 +44,24 @@ 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) { + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1.Gateway{}) + Invokes(testing.NewGetActionWithOptions(gatewaysResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { + emptyResult := &v1.GatewayList{} obj, err := c.Fake. - Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1.GatewayList{}) + Invokes(testing.NewListActionWithOptions(gatewaysResource, gatewaysKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeGateways) List(ctx context.Context, opts metav1.ListOptions) (resul // 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)) + InvokesWatch(testing.NewWatchActionWithOptions(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) { + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1.Gateway{}) + Invokes(testing.NewCreateActionWithOptions(gatewaysResource, c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1.Gateway{}) + Invokes(testing.NewUpdateActionWithOptions(gatewaysResource, c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { +func (c *FakeGateways) UpdateStatus(ctx context.Context, gateway *v1.Gateway, opts metav1.UpdateOptions) (result *v1.Gateway, err error) { + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(gatewaysResource, "status", c.ns, gateway), &v1.Gateway{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(gatewaysResource, "status", c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Gateway), err } @@ -126,7 +131,7 @@ func (c *FakeGateways) Delete(ctx context.Context, name string, opts metav1.Dele // 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) + action := testing.NewDeleteCollectionActionWithOptions(gatewaysResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.GatewayList{}) return err @@ -134,11 +139,12 @@ func (c *FakeGateways) DeleteCollection(ctx context.Context, opts metav1.DeleteO // 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) { + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, pt, data, subresources...), &v1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Gateway), err } @@ -156,11 +162,12 @@ func (c *FakeGateways) Apply(ctx context.Context, gateway *apisv1.GatewayApplyCo if name == nil { return nil, fmt.Errorf("gateway.Name must be provided to Apply") } + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, *name, types.ApplyPatchType, data), &v1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.Gateway), err } @@ -179,11 +186,12 @@ func (c *FakeGateways) ApplyStatus(ctx context.Context, gateway *apisv1.GatewayA if name == nil { return nil, fmt.Errorf("gateway.Name must be provided to Apply") } + emptyResult := &v1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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 index 69d777711a..4cec1cac6f 100644 --- 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 @@ -43,20 +43,22 @@ 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) { + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(gatewayclassesResource, name), &v1.GatewayClass{}) + Invokes(testing.NewRootGetActionWithOptions(gatewayclassesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { + emptyResult := &v1.GatewayClassList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(gatewayclassesResource, gatewayclassesKind, opts), &v1.GatewayClassList{}) + Invokes(testing.NewRootListActionWithOptions(gatewayclassesResource, gatewayclassesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,36 +77,39 @@ func (c *FakeGatewayClasses) List(ctx context.Context, opts metav1.ListOptions) // 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)) + InvokesWatch(testing.NewRootWatchActionWithOptions(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) { + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(gatewayclassesResource, gatewayClass), &v1.GatewayClass{}) + Invokes(testing.NewRootCreateActionWithOptions(gatewayclassesResource, gatewayClass, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(gatewayclassesResource, gatewayClass), &v1.GatewayClass{}) + Invokes(testing.NewRootUpdateActionWithOptions(gatewayclassesResource, gatewayClass, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { +func (c *FakeGatewayClasses) UpdateStatus(ctx context.Context, gatewayClass *v1.GatewayClass, opts metav1.UpdateOptions) (result *v1.GatewayClass, err error) { + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(gatewayclassesResource, "status", gatewayClass), &v1.GatewayClass{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(gatewayclassesResource, "status", gatewayClass, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GatewayClass), err } @@ -118,7 +123,7 @@ func (c *FakeGatewayClasses) Delete(ctx context.Context, name string, opts metav // 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) + action := testing.NewRootDeleteCollectionActionWithOptions(gatewayclassesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.GatewayClassList{}) return err @@ -126,10 +131,11 @@ func (c *FakeGatewayClasses) DeleteCollection(ctx context.Context, opts metav1.D // 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) { + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, name, pt, data, subresources...), &v1.GatewayClass{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(gatewayclassesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GatewayClass), err } @@ -147,10 +153,11 @@ func (c *FakeGatewayClasses) Apply(ctx context.Context, gatewayClass *apisv1.Gat if name == nil { return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") } + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, *name, types.ApplyPatchType, data), &v1.GatewayClass{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(gatewayclassesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GatewayClass), err } @@ -169,10 +176,11 @@ func (c *FakeGatewayClasses) ApplyStatus(ctx context.Context, gatewayClass *apis if name == nil { return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") } + emptyResult := &v1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, *name, types.ApplyPatchType, data, "status"), &v1.GatewayClass{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(gatewayclassesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GatewayClass), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_grpcroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_grpcroute.go index 9e6bf9f87f..e4992e422b 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/fake/fake_grpcroute.go @@ -44,22 +44,24 @@ var grpcroutesKind = v1.SchemeGroupVersion.WithKind("GRPCRoute") // Get takes name of the gRPCRoute, and returns the corresponding gRPCRoute object, and an error if there is any. func (c *FakeGRPCRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GRPCRoute, err error) { + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(grpcroutesResource, c.ns, name), &v1.GRPCRoute{}) + Invokes(testing.NewGetActionWithOptions(grpcroutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), err } // List takes label and field selectors, and returns the list of GRPCRoutes that match those selectors. func (c *FakeGRPCRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GRPCRouteList, err error) { + emptyResult := &v1.GRPCRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(grpcroutesResource, grpcroutesKind, c.ns, opts), &v1.GRPCRouteList{}) + Invokes(testing.NewListActionWithOptions(grpcroutesResource, grpcroutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeGRPCRoutes) List(ctx context.Context, opts metav1.ListOptions) (res // Watch returns a watch.Interface that watches the requested gRPCRoutes. func (c *FakeGRPCRoutes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(grpcroutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(grpcroutesResource, c.ns, opts)) } // Create takes the representation of a gRPCRoute and creates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. func (c *FakeGRPCRoutes) Create(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.CreateOptions) (result *v1.GRPCRoute, err error) { + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(grpcroutesResource, c.ns, gRPCRoute), &v1.GRPCRoute{}) + Invokes(testing.NewCreateActionWithOptions(grpcroutesResource, c.ns, gRPCRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), err } // Update takes the representation of a gRPCRoute and updates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. func (c *FakeGRPCRoutes) Update(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (result *v1.GRPCRoute, err error) { + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(grpcroutesResource, c.ns, gRPCRoute), &v1.GRPCRoute{}) + Invokes(testing.NewUpdateActionWithOptions(grpcroutesResource, c.ns, gRPCRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), 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 *FakeGRPCRoutes) UpdateStatus(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (*v1.GRPCRoute, error) { +func (c *FakeGRPCRoutes) UpdateStatus(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (result *v1.GRPCRoute, err error) { + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(grpcroutesResource, "status", c.ns, gRPCRoute), &v1.GRPCRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(grpcroutesResource, "status", c.ns, gRPCRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), err } @@ -126,7 +131,7 @@ func (c *FakeGRPCRoutes) Delete(ctx context.Context, name string, opts metav1.De // DeleteCollection deletes a collection of objects. func (c *FakeGRPCRoutes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionAction(grpcroutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(grpcroutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.GRPCRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeGRPCRoutes) DeleteCollection(ctx context.Context, opts metav1.Delet // Patch applies the patch and returns the patched gRPCRoute. func (c *FakeGRPCRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GRPCRoute, err error) { + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(grpcroutesResource, c.ns, name, pt, data, subresources...), &v1.GRPCRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(grpcroutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), err } @@ -156,11 +162,12 @@ func (c *FakeGRPCRoutes) Apply(ctx context.Context, gRPCRoute *apisv1.GRPCRouteA if name == nil { return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") } + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data), &v1.GRPCRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), err } @@ -179,11 +186,12 @@ func (c *FakeGRPCRoutes) ApplyStatus(ctx context.Context, gRPCRoute *apisv1.GRPC if name == nil { return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") } + emptyResult := &v1.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.GRPCRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.GRPCRoute), 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 index 77c2f0d7e4..2673628ea3 100644 --- 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 @@ -44,22 +44,24 @@ 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) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httproutesResource, c.ns, name), &v1.HTTPRoute{}) + Invokes(testing.NewGetActionWithOptions(httproutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { + emptyResult := &v1.HTTPRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httproutesResource, httproutesKind, c.ns, opts), &v1.HTTPRouteList{}) + Invokes(testing.NewListActionWithOptions(httproutesResource, httproutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeHTTPRoutes) List(ctx context.Context, opts metav1.ListOptions) (res // 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)) + InvokesWatch(testing.NewWatchActionWithOptions(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) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httproutesResource, c.ns, hTTPRoute), &v1.HTTPRoute{}) + Invokes(testing.NewCreateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httproutesResource, c.ns, hTTPRoute), &v1.HTTPRoute{}) + Invokes(testing.NewUpdateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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) { +func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1.HTTPRoute, opts metav1.UpdateOptions) (result *v1.HTTPRoute, err error) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httproutesResource, "status", c.ns, hTTPRoute), &v1.HTTPRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httproutesResource, "status", c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } @@ -126,7 +131,7 @@ func (c *FakeHTTPRoutes) Delete(ctx context.Context, name string, opts metav1.De // 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) + action := testing.NewDeleteCollectionActionWithOptions(httproutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1.HTTPRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts metav1.Delet // 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) { + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, name, pt, data, subresources...), &v1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } @@ -156,11 +162,12 @@ func (c *FakeHTTPRoutes) Apply(ctx context.Context, hTTPRoute *apisv1.HTTPRouteA if name == nil { return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") } + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, *name, types.ApplyPatchType, data), &v1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1.HTTPRoute), err } @@ -179,11 +186,12 @@ func (c *FakeHTTPRoutes) ApplyStatus(ctx context.Context, hTTPRoute *apisv1.HTTP if name == nil { return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") } + emptyResult := &v1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, 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 index 9ad264580d..0e7d9372a5 100644 --- 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 @@ -20,14 +20,11 @@ package v1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" v1 "sigs.k8s.io/gateway-api/apis/v1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type GatewaysGetter interface { 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) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 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 @@ -51,206 +49,25 @@ type GatewayInterface interface { 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) Apply(ctx context.Context, gateway *apisv1.GatewayApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Gateway, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, gateway *apisv1.GatewayApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Gateway, err error) GatewayExpansion } // gateways implements GatewayInterface type gateways struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1.Gateway, *v1.GatewayList, *apisv1.GatewayApplyConfiguration] } // newGateways returns a Gateways func newGateways(c *GatewayV1Client, namespace string) *gateways { return &gateways{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1.Gateway, *v1.GatewayList, *apisv1.GatewayApplyConfiguration]( + "gateways", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.Gateway { return &v1.Gateway{} }, + func() *v1.GatewayList { return &v1.GatewayList{} }), } } - -// 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 -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied gateway. -func (c *gateways) Apply(ctx context.Context, gateway *apisv1.GatewayApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Gateway, err error) { - if gateway == nil { - return nil, fmt.Errorf("gateway provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gateway) - if err != nil { - return nil, err - } - name := gateway.Name - if name == nil { - return nil, fmt.Errorf("gateway.Name must be provided to Apply") - } - result = &v1.Gateway{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("gateways"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *gateways) ApplyStatus(ctx context.Context, gateway *apisv1.GatewayApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Gateway, err error) { - if gateway == nil { - return nil, fmt.Errorf("gateway provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gateway) - if err != nil { - return nil, err - } - - name := gateway.Name - if name == nil { - return nil, fmt.Errorf("gateway.Name must be provided to Apply") - } - - result = &v1.Gateway{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("gateways"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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 index 817b92a7c3..2f764f147d 100644 --- 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 @@ -20,14 +20,11 @@ package v1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" v1 "sigs.k8s.io/gateway-api/apis/v1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type GatewayClassesGetter interface { 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) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 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 @@ -51,193 +49,25 @@ type GatewayClassInterface interface { 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) Apply(ctx context.Context, gatewayClass *apisv1.GatewayClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GatewayClass, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, gatewayClass *apisv1.GatewayClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GatewayClass, err error) GatewayClassExpansion } // gatewayClasses implements GatewayClassInterface type gatewayClasses struct { - client rest.Interface + *gentype.ClientWithListAndApply[*v1.GatewayClass, *v1.GatewayClassList, *apisv1.GatewayClassApplyConfiguration] } // newGatewayClasses returns a GatewayClasses func newGatewayClasses(c *GatewayV1Client) *gatewayClasses { return &gatewayClasses{ - client: c.RESTClient(), + gentype.NewClientWithListAndApply[*v1.GatewayClass, *v1.GatewayClassList, *apisv1.GatewayClassApplyConfiguration]( + "gatewayclasses", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1.GatewayClass { return &v1.GatewayClass{} }, + func() *v1.GatewayClassList { return &v1.GatewayClassList{} }), } } - -// 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 -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied gatewayClass. -func (c *gatewayClasses) Apply(ctx context.Context, gatewayClass *apisv1.GatewayClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GatewayClass, err error) { - if gatewayClass == nil { - return nil, fmt.Errorf("gatewayClass provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gatewayClass) - if err != nil { - return nil, err - } - name := gatewayClass.Name - if name == nil { - return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") - } - result = &v1.GatewayClass{} - err = c.client.Patch(types.ApplyPatchType). - Resource("gatewayclasses"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *gatewayClasses) ApplyStatus(ctx context.Context, gatewayClass *apisv1.GatewayClassApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GatewayClass, err error) { - if gatewayClass == nil { - return nil, fmt.Errorf("gatewayClass provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gatewayClass) - if err != nil { - return nil, err - } - - name := gatewayClass.Name - if name == nil { - return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") - } - - result = &v1.GatewayClass{} - err = c.client.Patch(types.ApplyPatchType). - Resource("gatewayclasses"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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/grpcroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/grpcroute.go index f8e1c2132f..55748a1d29 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/grpcroute.go @@ -20,14 +20,11 @@ package v1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" v1 "sigs.k8s.io/gateway-api/apis/v1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type GRPCRoutesGetter interface { type GRPCRouteInterface interface { Create(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.CreateOptions) (*v1.GRPCRoute, error) Update(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (*v1.GRPCRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (*v1.GRPCRoute, error) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error @@ -51,206 +49,25 @@ type GRPCRouteInterface interface { 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.GRPCRoute, err error) Apply(ctx context.Context, gRPCRoute *apisv1.GRPCRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GRPCRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, gRPCRoute *apisv1.GRPCRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GRPCRoute, err error) GRPCRouteExpansion } // gRPCRoutes implements GRPCRouteInterface type gRPCRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1.GRPCRoute, *v1.GRPCRouteList, *apisv1.GRPCRouteApplyConfiguration] } // newGRPCRoutes returns a GRPCRoutes func newGRPCRoutes(c *GatewayV1Client, namespace string) *gRPCRoutes { return &gRPCRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1.GRPCRoute, *v1.GRPCRouteList, *apisv1.GRPCRouteApplyConfiguration]( + "grpcroutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.GRPCRoute { return &v1.GRPCRoute{} }, + func() *v1.GRPCRouteList { return &v1.GRPCRouteList{} }), } } - -// Get takes name of the gRPCRoute, and returns the corresponding gRPCRoute object, and an error if there is any. -func (c *gRPCRoutes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.GRPCRoute, err error) { - result = &v1.GRPCRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of GRPCRoutes that match those selectors. -func (c *gRPCRoutes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.GRPCRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1.GRPCRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("grpcroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gRPCRoutes. -func (c *gRPCRoutes) 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("grpcroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a gRPCRoute and creates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. -func (c *gRPCRoutes) Create(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.CreateOptions) (result *v1.GRPCRoute, err error) { - result = &v1.GRPCRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("grpcroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gRPCRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a gRPCRoute and updates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. -func (c *gRPCRoutes) Update(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (result *v1.GRPCRoute, err error) { - result = &v1.GRPCRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(gRPCRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gRPCRoute). - 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 *gRPCRoutes) UpdateStatus(ctx context.Context, gRPCRoute *v1.GRPCRoute, opts metav1.UpdateOptions) (result *v1.GRPCRoute, err error) { - result = &v1.GRPCRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(gRPCRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gRPCRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the gRPCRoute and deletes it. Returns an error if one occurs. -func (c *gRPCRoutes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gRPCRoutes) 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("grpcroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched gRPCRoute. -func (c *gRPCRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.GRPCRoute, err error) { - result = &v1.GRPCRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("grpcroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied gRPCRoute. -func (c *gRPCRoutes) Apply(ctx context.Context, gRPCRoute *apisv1.GRPCRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GRPCRoute, err error) { - if gRPCRoute == nil { - return nil, fmt.Errorf("gRPCRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gRPCRoute) - if err != nil { - return nil, err - } - name := gRPCRoute.Name - if name == nil { - return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") - } - result = &v1.GRPCRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("grpcroutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *gRPCRoutes) ApplyStatus(ctx context.Context, gRPCRoute *apisv1.GRPCRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.GRPCRoute, err error) { - if gRPCRoute == nil { - return nil, fmt.Errorf("gRPCRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gRPCRoute) - if err != nil { - return nil, err - } - - name := gRPCRoute.Name - if name == nil { - return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") - } - - result = &v1.GRPCRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("grpcroutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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/httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1/httproute.go index 89cab587c2..29f4fe9c6b 100644 --- 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 @@ -20,14 +20,11 @@ package v1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1" v1 "sigs.k8s.io/gateway-api/apis/v1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type HTTPRoutesGetter interface { 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) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 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 @@ -51,206 +49,25 @@ type HTTPRouteInterface interface { 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) Apply(ctx context.Context, hTTPRoute *apisv1.HTTPRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HTTPRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, hTTPRoute *apisv1.HTTPRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HTTPRoute, err error) HTTPRouteExpansion } // hTTPRoutes implements HTTPRouteInterface type hTTPRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1.HTTPRoute, *v1.HTTPRouteList, *apisv1.HTTPRouteApplyConfiguration] } // newHTTPRoutes returns a HTTPRoutes func newHTTPRoutes(c *GatewayV1Client, namespace string) *hTTPRoutes { return &hTTPRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1.HTTPRoute, *v1.HTTPRouteList, *apisv1.HTTPRouteApplyConfiguration]( + "httproutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1.HTTPRoute { return &v1.HTTPRoute{} }, + func() *v1.HTTPRouteList { return &v1.HTTPRouteList{} }), } } - -// 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 -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied hTTPRoute. -func (c *hTTPRoutes) Apply(ctx context.Context, hTTPRoute *apisv1.HTTPRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HTTPRoute, err error) { - if hTTPRoute == nil { - return nil, fmt.Errorf("hTTPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(hTTPRoute) - if err != nil { - return nil, err - } - name := hTTPRoute.Name - if name == nil { - return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") - } - result = &v1.HTTPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("httproutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *hTTPRoutes) ApplyStatus(ctx context.Context, hTTPRoute *apisv1.HTTPRouteApplyConfiguration, opts metav1.ApplyOptions) (result *v1.HTTPRoute, err error) { - if hTTPRoute == nil { - return nil, fmt.Errorf("hTTPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(hTTPRoute) - if err != nil { - return nil, err - } - - name := hTTPRoute.Name - if name == nil { - return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") - } - - result = &v1.HTTPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("httproutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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/backendlbpolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendlbpolicy.go index 514cac1e28..0429945002 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendlbpolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/backendlbpolicy.go @@ -20,14 +20,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type BackendLBPoliciesGetter interface { type BackendLBPolicyInterface interface { Create(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.CreateOptions) (*v1alpha2.BackendLBPolicy, error) Update(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendLBPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendLBPolicy, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type BackendLBPolicyInterface interface { 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.BackendLBPolicy, err error) Apply(ctx context.Context, backendLBPolicy *apisv1alpha2.BackendLBPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendLBPolicy, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, backendLBPolicy *apisv1alpha2.BackendLBPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendLBPolicy, err error) BackendLBPolicyExpansion } // backendLBPolicies implements BackendLBPolicyInterface type backendLBPolicies struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.BackendLBPolicy, *v1alpha2.BackendLBPolicyList, *apisv1alpha2.BackendLBPolicyApplyConfiguration] } // newBackendLBPolicies returns a BackendLBPolicies func newBackendLBPolicies(c *GatewayV1alpha2Client, namespace string) *backendLBPolicies { return &backendLBPolicies{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.BackendLBPolicy, *v1alpha2.BackendLBPolicyList, *apisv1alpha2.BackendLBPolicyApplyConfiguration]( + "backendlbpolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.BackendLBPolicy { return &v1alpha2.BackendLBPolicy{} }, + func() *v1alpha2.BackendLBPolicyList { return &v1alpha2.BackendLBPolicyList{} }), } } - -// Get takes name of the backendLBPolicy, and returns the corresponding backendLBPolicy object, and an error if there is any. -func (c *backendLBPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendLBPolicy, err error) { - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of BackendLBPolicies that match those selectors. -func (c *backendLBPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendLBPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.BackendLBPolicyList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("backendlbpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested backendLBPolicies. -func (c *backendLBPolicies) 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("backendlbpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a backendLBPolicy and creates it. Returns the server's representation of the backendLBPolicy, and an error, if there is any. -func (c *backendLBPolicies) Create(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendLBPolicy, err error) { - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Post(). - Namespace(c.ns). - Resource("backendlbpolicies"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backendLBPolicy). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a backendLBPolicy and updates it. Returns the server's representation of the backendLBPolicy, and an error, if there is any. -func (c *backendLBPolicies) Update(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendLBPolicy, err error) { - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(backendLBPolicy.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backendLBPolicy). - 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 *backendLBPolicies) UpdateStatus(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendLBPolicy, err error) { - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Put(). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(backendLBPolicy.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(backendLBPolicy). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the backendLBPolicy and deletes it. Returns an error if one occurs. -func (c *backendLBPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *backendLBPolicies) 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("backendlbpolicies"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched backendLBPolicy. -func (c *backendLBPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendLBPolicy, err error) { - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied backendLBPolicy. -func (c *backendLBPolicies) Apply(ctx context.Context, backendLBPolicy *apisv1alpha2.BackendLBPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendLBPolicy, err error) { - if backendLBPolicy == nil { - return nil, fmt.Errorf("backendLBPolicy provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(backendLBPolicy) - if err != nil { - return nil, err - } - name := backendLBPolicy.Name - if name == nil { - return nil, fmt.Errorf("backendLBPolicy.Name must be provided to Apply") - } - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *backendLBPolicies) ApplyStatus(ctx context.Context, backendLBPolicy *apisv1alpha2.BackendLBPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.BackendLBPolicy, err error) { - if backendLBPolicy == nil { - return nil, fmt.Errorf("backendLBPolicy provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(backendLBPolicy) - if err != nil { - return nil, err - } - - name := backendLBPolicy.Name - if name == nil { - return nil, fmt.Errorf("backendLBPolicy.Name must be provided to Apply") - } - - result = &v1alpha2.BackendLBPolicy{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("backendlbpolicies"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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_backendlbpolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendlbpolicy.go index dab088600b..9053eac042 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendlbpolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_backendlbpolicy.go @@ -44,22 +44,24 @@ var backendlbpoliciesKind = v1alpha2.SchemeGroupVersion.WithKind("BackendLBPolic // Get takes name of the backendLBPolicy, and returns the corresponding backendLBPolicy object, and an error if there is any. func (c *FakeBackendLBPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.BackendLBPolicy, err error) { + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewGetAction(backendlbpoliciesResource, c.ns, name), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewGetActionWithOptions(backendlbpoliciesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), err } // List takes label and field selectors, and returns the list of BackendLBPolicies that match those selectors. func (c *FakeBackendLBPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.BackendLBPolicyList, err error) { + emptyResult := &v1alpha2.BackendLBPolicyList{} obj, err := c.Fake. - Invokes(testing.NewListAction(backendlbpoliciesResource, backendlbpoliciesKind, c.ns, opts), &v1alpha2.BackendLBPolicyList{}) + Invokes(testing.NewListActionWithOptions(backendlbpoliciesResource, backendlbpoliciesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeBackendLBPolicies) List(ctx context.Context, opts v1.ListOptions) ( // Watch returns a watch.Interface that watches the requested backendLBPolicies. func (c *FakeBackendLBPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(backendlbpoliciesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(backendlbpoliciesResource, c.ns, opts)) } // Create takes the representation of a backendLBPolicy and creates it. Returns the server's representation of the backendLBPolicy, and an error, if there is any. func (c *FakeBackendLBPolicies) Create(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.CreateOptions) (result *v1alpha2.BackendLBPolicy, err error) { + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(backendlbpoliciesResource, c.ns, backendLBPolicy), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewCreateActionWithOptions(backendlbpoliciesResource, c.ns, backendLBPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), err } // Update takes the representation of a backendLBPolicy and updates it. Returns the server's representation of the backendLBPolicy, and an error, if there is any. func (c *FakeBackendLBPolicies) Update(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendLBPolicy, err error) { + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(backendlbpoliciesResource, c.ns, backendLBPolicy), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewUpdateActionWithOptions(backendlbpoliciesResource, c.ns, backendLBPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), 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 *FakeBackendLBPolicies) UpdateStatus(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (*v1alpha2.BackendLBPolicy, error) { +func (c *FakeBackendLBPolicies) UpdateStatus(ctx context.Context, backendLBPolicy *v1alpha2.BackendLBPolicy, opts v1.UpdateOptions) (result *v1alpha2.BackendLBPolicy, err error) { + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(backendlbpoliciesResource, "status", c.ns, backendLBPolicy), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(backendlbpoliciesResource, "status", c.ns, backendLBPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), err } @@ -126,7 +131,7 @@ func (c *FakeBackendLBPolicies) Delete(ctx context.Context, name string, opts v1 // DeleteCollection deletes a collection of objects. func (c *FakeBackendLBPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(backendlbpoliciesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(backendlbpoliciesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.BackendLBPolicyList{}) return err @@ -134,11 +139,12 @@ func (c *FakeBackendLBPolicies) DeleteCollection(ctx context.Context, opts v1.De // Patch applies the patch and returns the patched backendLBPolicy. func (c *FakeBackendLBPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.BackendLBPolicy, err error) { + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendlbpoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(backendlbpoliciesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), err } @@ -156,11 +162,12 @@ func (c *FakeBackendLBPolicies) Apply(ctx context.Context, backendLBPolicy *apis if name == nil { return nil, fmt.Errorf("backendLBPolicy.Name must be provided to Apply") } + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendlbpoliciesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(backendlbpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), err } @@ -179,11 +186,12 @@ func (c *FakeBackendLBPolicies) ApplyStatus(ctx context.Context, backendLBPolicy if name == nil { return nil, fmt.Errorf("backendLBPolicy.Name must be provided to Apply") } + emptyResult := &v1alpha2.BackendLBPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendlbpoliciesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha2.BackendLBPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(backendlbpoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.BackendLBPolicy), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_grpcroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_grpcroute.go index 3059cb9944..82ea2b8db7 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_grpcroute.go @@ -44,22 +44,24 @@ var grpcroutesKind = v1alpha2.SchemeGroupVersion.WithKind("GRPCRoute") // Get takes name of the gRPCRoute, and returns the corresponding gRPCRoute object, and an error if there is any. func (c *FakeGRPCRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.GRPCRoute, err error) { + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(grpcroutesResource, c.ns, name), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewGetActionWithOptions(grpcroutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), err } // List takes label and field selectors, and returns the list of GRPCRoutes that match those selectors. func (c *FakeGRPCRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.GRPCRouteList, err error) { + emptyResult := &v1alpha2.GRPCRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(grpcroutesResource, grpcroutesKind, c.ns, opts), &v1alpha2.GRPCRouteList{}) + Invokes(testing.NewListActionWithOptions(grpcroutesResource, grpcroutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeGRPCRoutes) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested gRPCRoutes. func (c *FakeGRPCRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(grpcroutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(grpcroutesResource, c.ns, opts)) } // Create takes the representation of a gRPCRoute and creates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. func (c *FakeGRPCRoutes) Create(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.CreateOptions) (result *v1alpha2.GRPCRoute, err error) { + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(grpcroutesResource, c.ns, gRPCRoute), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewCreateActionWithOptions(grpcroutesResource, c.ns, gRPCRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), err } // Update takes the representation of a gRPCRoute and updates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. func (c *FakeGRPCRoutes) Update(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (result *v1alpha2.GRPCRoute, err error) { + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(grpcroutesResource, c.ns, gRPCRoute), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewUpdateActionWithOptions(grpcroutesResource, c.ns, gRPCRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), 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 *FakeGRPCRoutes) UpdateStatus(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (*v1alpha2.GRPCRoute, error) { +func (c *FakeGRPCRoutes) UpdateStatus(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (result *v1alpha2.GRPCRoute, err error) { + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(grpcroutesResource, "status", c.ns, gRPCRoute), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(grpcroutesResource, "status", c.ns, gRPCRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), err } @@ -126,7 +131,7 @@ func (c *FakeGRPCRoutes) Delete(ctx context.Context, name string, opts v1.Delete // DeleteCollection deletes a collection of objects. func (c *FakeGRPCRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(grpcroutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(grpcroutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.GRPCRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeGRPCRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOpt // Patch applies the patch and returns the patched gRPCRoute. func (c *FakeGRPCRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.GRPCRoute, err error) { + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(grpcroutesResource, c.ns, name, pt, data, subresources...), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(grpcroutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), err } @@ -156,11 +162,12 @@ func (c *FakeGRPCRoutes) Apply(ctx context.Context, gRPCRoute *apisv1alpha2.GRPC if name == nil { return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), err } @@ -179,11 +186,12 @@ func (c *FakeGRPCRoutes) ApplyStatus(ctx context.Context, gRPCRoute *apisv1alpha if name == nil { return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.GRPCRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha2.GRPCRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(grpcroutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.GRPCRoute), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencegrant.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencegrant.go index 50c90fa8a1..31b65d3a5b 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_referencegrant.go @@ -44,22 +44,24 @@ var referencegrantsKind = v1alpha2.SchemeGroupVersion.WithKind("ReferenceGrant") // Get takes name of the referenceGrant, and returns the corresponding referenceGrant object, and an error if there is any. func (c *FakeReferenceGrants) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ReferenceGrant, err error) { + emptyResult := &v1alpha2.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewGetAction(referencegrantsResource, c.ns, name), &v1alpha2.ReferenceGrant{}) + Invokes(testing.NewGetActionWithOptions(referencegrantsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ReferenceGrant), err } // List takes label and field selectors, and returns the list of ReferenceGrants that match those selectors. func (c *FakeReferenceGrants) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ReferenceGrantList, err error) { + emptyResult := &v1alpha2.ReferenceGrantList{} obj, err := c.Fake. - Invokes(testing.NewListAction(referencegrantsResource, referencegrantsKind, c.ns, opts), &v1alpha2.ReferenceGrantList{}) + Invokes(testing.NewListActionWithOptions(referencegrantsResource, referencegrantsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,28 +80,30 @@ func (c *FakeReferenceGrants) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested referenceGrants. func (c *FakeReferenceGrants) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(referencegrantsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(referencegrantsResource, c.ns, opts)) } // Create takes the representation of a referenceGrant and creates it. Returns the server's representation of the referenceGrant, and an error, if there is any. func (c *FakeReferenceGrants) Create(ctx context.Context, referenceGrant *v1alpha2.ReferenceGrant, opts v1.CreateOptions) (result *v1alpha2.ReferenceGrant, err error) { + emptyResult := &v1alpha2.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(referencegrantsResource, c.ns, referenceGrant), &v1alpha2.ReferenceGrant{}) + Invokes(testing.NewCreateActionWithOptions(referencegrantsResource, c.ns, referenceGrant, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ReferenceGrant), err } // Update takes the representation of a referenceGrant and updates it. Returns the server's representation of the referenceGrant, and an error, if there is any. func (c *FakeReferenceGrants) Update(ctx context.Context, referenceGrant *v1alpha2.ReferenceGrant, opts v1.UpdateOptions) (result *v1alpha2.ReferenceGrant, err error) { + emptyResult := &v1alpha2.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(referencegrantsResource, c.ns, referenceGrant), &v1alpha2.ReferenceGrant{}) + Invokes(testing.NewUpdateActionWithOptions(referencegrantsResource, c.ns, referenceGrant, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ReferenceGrant), err } @@ -114,7 +118,7 @@ func (c *FakeReferenceGrants) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeReferenceGrants) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(referencegrantsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(referencegrantsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.ReferenceGrantList{}) return err @@ -122,11 +126,12 @@ func (c *FakeReferenceGrants) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched referenceGrant. func (c *FakeReferenceGrants) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ReferenceGrant, err error) { + emptyResult := &v1alpha2.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(referencegrantsResource, c.ns, name, pt, data, subresources...), &v1alpha2.ReferenceGrant{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(referencegrantsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ReferenceGrant), err } @@ -144,11 +149,12 @@ func (c *FakeReferenceGrants) Apply(ctx context.Context, referenceGrant *apisv1a if name == nil { return nil, fmt.Errorf("referenceGrant.Name must be provided to Apply") } + emptyResult := &v1alpha2.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(referencegrantsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.ReferenceGrant{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(referencegrantsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.ReferenceGrant), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tcproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tcproute.go index b93e76628d..32b88e16c3 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tcproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tcproute.go @@ -44,22 +44,24 @@ var tcproutesKind = v1alpha2.SchemeGroupVersion.WithKind("TCPRoute") // Get takes name of the tCPRoute, and returns the corresponding tCPRoute object, and an error if there is any. func (c *FakeTCPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TCPRoute, err error) { + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(tcproutesResource, c.ns, name), &v1alpha2.TCPRoute{}) + Invokes(testing.NewGetActionWithOptions(tcproutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), err } // List takes label and field selectors, and returns the list of TCPRoutes that match those selectors. func (c *FakeTCPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TCPRouteList, err error) { + emptyResult := &v1alpha2.TCPRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(tcproutesResource, tcproutesKind, c.ns, opts), &v1alpha2.TCPRouteList{}) + Invokes(testing.NewListActionWithOptions(tcproutesResource, tcproutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeTCPRoutes) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested tCPRoutes. func (c *FakeTCPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(tcproutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(tcproutesResource, c.ns, opts)) } // Create takes the representation of a tCPRoute and creates it. Returns the server's representation of the tCPRoute, and an error, if there is any. func (c *FakeTCPRoutes) Create(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.CreateOptions) (result *v1alpha2.TCPRoute, err error) { + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(tcproutesResource, c.ns, tCPRoute), &v1alpha2.TCPRoute{}) + Invokes(testing.NewCreateActionWithOptions(tcproutesResource, c.ns, tCPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), err } // Update takes the representation of a tCPRoute and updates it. Returns the server's representation of the tCPRoute, and an error, if there is any. func (c *FakeTCPRoutes) Update(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (result *v1alpha2.TCPRoute, err error) { + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tcproutesResource, c.ns, tCPRoute), &v1alpha2.TCPRoute{}) + Invokes(testing.NewUpdateActionWithOptions(tcproutesResource, c.ns, tCPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), 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 *FakeTCPRoutes) UpdateStatus(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (*v1alpha2.TCPRoute, error) { +func (c *FakeTCPRoutes) UpdateStatus(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (result *v1alpha2.TCPRoute, err error) { + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(tcproutesResource, "status", c.ns, tCPRoute), &v1alpha2.TCPRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(tcproutesResource, "status", c.ns, tCPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), err } @@ -126,7 +131,7 @@ func (c *FakeTCPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeTCPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(tcproutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(tcproutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.TCPRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeTCPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched tCPRoute. func (c *FakeTCPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TCPRoute, err error) { + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tcproutesResource, c.ns, name, pt, data, subresources...), &v1alpha2.TCPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(tcproutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), err } @@ -156,11 +162,12 @@ func (c *FakeTCPRoutes) Apply(ctx context.Context, tCPRoute *apisv1alpha2.TCPRou if name == nil { return nil, fmt.Errorf("tCPRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tcproutesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.TCPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(tcproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), err } @@ -179,11 +186,12 @@ func (c *FakeTCPRoutes) ApplyStatus(ctx context.Context, tCPRoute *apisv1alpha2. if name == nil { return nil, fmt.Errorf("tCPRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.TCPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tcproutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha2.TCPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(tcproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TCPRoute), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tlsroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tlsroute.go index 9383876158..ba8255216f 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tlsroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_tlsroute.go @@ -44,22 +44,24 @@ var tlsroutesKind = v1alpha2.SchemeGroupVersion.WithKind("TLSRoute") // Get takes name of the tLSRoute, and returns the corresponding tLSRoute object, and an error if there is any. func (c *FakeTLSRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TLSRoute, err error) { + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(tlsroutesResource, c.ns, name), &v1alpha2.TLSRoute{}) + Invokes(testing.NewGetActionWithOptions(tlsroutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), err } // List takes label and field selectors, and returns the list of TLSRoutes that match those selectors. func (c *FakeTLSRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TLSRouteList, err error) { + emptyResult := &v1alpha2.TLSRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(tlsroutesResource, tlsroutesKind, c.ns, opts), &v1alpha2.TLSRouteList{}) + Invokes(testing.NewListActionWithOptions(tlsroutesResource, tlsroutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeTLSRoutes) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested tLSRoutes. func (c *FakeTLSRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(tlsroutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(tlsroutesResource, c.ns, opts)) } // Create takes the representation of a tLSRoute and creates it. Returns the server's representation of the tLSRoute, and an error, if there is any. func (c *FakeTLSRoutes) Create(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.CreateOptions) (result *v1alpha2.TLSRoute, err error) { + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(tlsroutesResource, c.ns, tLSRoute), &v1alpha2.TLSRoute{}) + Invokes(testing.NewCreateActionWithOptions(tlsroutesResource, c.ns, tLSRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), err } // Update takes the representation of a tLSRoute and updates it. Returns the server's representation of the tLSRoute, and an error, if there is any. func (c *FakeTLSRoutes) Update(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (result *v1alpha2.TLSRoute, err error) { + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(tlsroutesResource, c.ns, tLSRoute), &v1alpha2.TLSRoute{}) + Invokes(testing.NewUpdateActionWithOptions(tlsroutesResource, c.ns, tLSRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), 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 *FakeTLSRoutes) UpdateStatus(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (*v1alpha2.TLSRoute, error) { +func (c *FakeTLSRoutes) UpdateStatus(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (result *v1alpha2.TLSRoute, err error) { + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(tlsroutesResource, "status", c.ns, tLSRoute), &v1alpha2.TLSRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(tlsroutesResource, "status", c.ns, tLSRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), err } @@ -126,7 +131,7 @@ func (c *FakeTLSRoutes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeTLSRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(tlsroutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(tlsroutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.TLSRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeTLSRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched tLSRoute. func (c *FakeTLSRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TLSRoute, err error) { + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tlsroutesResource, c.ns, name, pt, data, subresources...), &v1alpha2.TLSRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(tlsroutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), err } @@ -156,11 +162,12 @@ func (c *FakeTLSRoutes) Apply(ctx context.Context, tLSRoute *apisv1alpha2.TLSRou if name == nil { return nil, fmt.Errorf("tLSRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tlsroutesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.TLSRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(tlsroutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), err } @@ -179,11 +186,12 @@ func (c *FakeTLSRoutes) ApplyStatus(ctx context.Context, tLSRoute *apisv1alpha2. if name == nil { return nil, fmt.Errorf("tLSRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.TLSRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(tlsroutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha2.TLSRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(tlsroutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.TLSRoute), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_udproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_udproute.go index 027f4a4c17..54a5b4d725 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_udproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/fake/fake_udproute.go @@ -44,22 +44,24 @@ var udproutesKind = v1alpha2.SchemeGroupVersion.WithKind("UDPRoute") // Get takes name of the uDPRoute, and returns the corresponding uDPRoute object, and an error if there is any. func (c *FakeUDPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.UDPRoute, err error) { + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(udproutesResource, c.ns, name), &v1alpha2.UDPRoute{}) + Invokes(testing.NewGetActionWithOptions(udproutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), err } // List takes label and field selectors, and returns the list of UDPRoutes that match those selectors. func (c *FakeUDPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.UDPRouteList, err error) { + emptyResult := &v1alpha2.UDPRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(udproutesResource, udproutesKind, c.ns, opts), &v1alpha2.UDPRouteList{}) + Invokes(testing.NewListActionWithOptions(udproutesResource, udproutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeUDPRoutes) List(ctx context.Context, opts v1.ListOptions) (result * // Watch returns a watch.Interface that watches the requested uDPRoutes. func (c *FakeUDPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(udproutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(udproutesResource, c.ns, opts)) } // Create takes the representation of a uDPRoute and creates it. Returns the server's representation of the uDPRoute, and an error, if there is any. func (c *FakeUDPRoutes) Create(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.CreateOptions) (result *v1alpha2.UDPRoute, err error) { + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(udproutesResource, c.ns, uDPRoute), &v1alpha2.UDPRoute{}) + Invokes(testing.NewCreateActionWithOptions(udproutesResource, c.ns, uDPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), err } // Update takes the representation of a uDPRoute and updates it. Returns the server's representation of the uDPRoute, and an error, if there is any. func (c *FakeUDPRoutes) Update(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (result *v1alpha2.UDPRoute, err error) { + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(udproutesResource, c.ns, uDPRoute), &v1alpha2.UDPRoute{}) + Invokes(testing.NewUpdateActionWithOptions(udproutesResource, c.ns, uDPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), 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 *FakeUDPRoutes) UpdateStatus(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (*v1alpha2.UDPRoute, error) { +func (c *FakeUDPRoutes) UpdateStatus(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (result *v1alpha2.UDPRoute, err error) { + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(udproutesResource, "status", c.ns, uDPRoute), &v1alpha2.UDPRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(udproutesResource, "status", c.ns, uDPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), err } @@ -126,7 +131,7 @@ func (c *FakeUDPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteO // DeleteCollection deletes a collection of objects. func (c *FakeUDPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(udproutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(udproutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha2.UDPRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeUDPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOpti // Patch applies the patch and returns the patched uDPRoute. func (c *FakeUDPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.UDPRoute, err error) { + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(udproutesResource, c.ns, name, pt, data, subresources...), &v1alpha2.UDPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(udproutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), err } @@ -156,11 +162,12 @@ func (c *FakeUDPRoutes) Apply(ctx context.Context, uDPRoute *apisv1alpha2.UDPRou if name == nil { return nil, fmt.Errorf("uDPRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(udproutesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha2.UDPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(udproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), err } @@ -179,11 +186,12 @@ func (c *FakeUDPRoutes) ApplyStatus(ctx context.Context, uDPRoute *apisv1alpha2. if name == nil { return nil, fmt.Errorf("uDPRoute.Name must be provided to Apply") } + emptyResult := &v1alpha2.UDPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(udproutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha2.UDPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(udproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha2.UDPRoute), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/grpcroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/grpcroute.go index 5e08af49dd..75752337e9 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/grpcroute.go @@ -20,14 +20,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type GRPCRoutesGetter interface { type GRPCRouteInterface interface { Create(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.CreateOptions) (*v1alpha2.GRPCRoute, error) Update(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (*v1alpha2.GRPCRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (*v1alpha2.GRPCRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type GRPCRouteInterface interface { 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.GRPCRoute, err error) Apply(ctx context.Context, gRPCRoute *apisv1alpha2.GRPCRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.GRPCRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, gRPCRoute *apisv1alpha2.GRPCRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.GRPCRoute, err error) GRPCRouteExpansion } // gRPCRoutes implements GRPCRouteInterface type gRPCRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.GRPCRoute, *v1alpha2.GRPCRouteList, *apisv1alpha2.GRPCRouteApplyConfiguration] } // newGRPCRoutes returns a GRPCRoutes func newGRPCRoutes(c *GatewayV1alpha2Client, namespace string) *gRPCRoutes { return &gRPCRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.GRPCRoute, *v1alpha2.GRPCRouteList, *apisv1alpha2.GRPCRouteApplyConfiguration]( + "grpcroutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.GRPCRoute { return &v1alpha2.GRPCRoute{} }, + func() *v1alpha2.GRPCRouteList { return &v1alpha2.GRPCRouteList{} }), } } - -// Get takes name of the gRPCRoute, and returns the corresponding gRPCRoute object, and an error if there is any. -func (c *gRPCRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.GRPCRoute, err error) { - result = &v1alpha2.GRPCRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of GRPCRoutes that match those selectors. -func (c *gRPCRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.GRPCRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.GRPCRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("grpcroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gRPCRoutes. -func (c *gRPCRoutes) 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("grpcroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a gRPCRoute and creates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. -func (c *gRPCRoutes) Create(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.CreateOptions) (result *v1alpha2.GRPCRoute, err error) { - result = &v1alpha2.GRPCRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("grpcroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gRPCRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a gRPCRoute and updates it. Returns the server's representation of the gRPCRoute, and an error, if there is any. -func (c *gRPCRoutes) Update(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (result *v1alpha2.GRPCRoute, err error) { - result = &v1alpha2.GRPCRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(gRPCRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gRPCRoute). - 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 *gRPCRoutes) UpdateStatus(ctx context.Context, gRPCRoute *v1alpha2.GRPCRoute, opts v1.UpdateOptions) (result *v1alpha2.GRPCRoute, err error) { - result = &v1alpha2.GRPCRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(gRPCRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(gRPCRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the gRPCRoute and deletes it. Returns an error if one occurs. -func (c *gRPCRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("grpcroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gRPCRoutes) 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("grpcroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched gRPCRoute. -func (c *gRPCRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.GRPCRoute, err error) { - result = &v1alpha2.GRPCRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("grpcroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied gRPCRoute. -func (c *gRPCRoutes) Apply(ctx context.Context, gRPCRoute *apisv1alpha2.GRPCRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.GRPCRoute, err error) { - if gRPCRoute == nil { - return nil, fmt.Errorf("gRPCRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gRPCRoute) - if err != nil { - return nil, err - } - name := gRPCRoute.Name - if name == nil { - return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") - } - result = &v1alpha2.GRPCRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("grpcroutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *gRPCRoutes) ApplyStatus(ctx context.Context, gRPCRoute *apisv1alpha2.GRPCRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.GRPCRoute, err error) { - if gRPCRoute == nil { - return nil, fmt.Errorf("gRPCRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gRPCRoute) - if err != nil { - return nil, err - } - - name := gRPCRoute.Name - if name == nil { - return nil, fmt.Errorf("gRPCRoute.Name must be provided to Apply") - } - - result = &v1alpha2.GRPCRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("grpcroutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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/referencegrant.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/referencegrant.go index ca799f71a1..bbe6f8790e 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/referencegrant.go @@ -20,14 +20,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -55,154 +52,18 @@ type ReferenceGrantInterface interface { // referenceGrants implements ReferenceGrantInterface type referenceGrants struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.ReferenceGrant, *v1alpha2.ReferenceGrantList, *apisv1alpha2.ReferenceGrantApplyConfiguration] } // newReferenceGrants returns a ReferenceGrants func newReferenceGrants(c *GatewayV1alpha2Client, namespace string) *referenceGrants { return &referenceGrants{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.ReferenceGrant, *v1alpha2.ReferenceGrantList, *apisv1alpha2.ReferenceGrantApplyConfiguration]( + "referencegrants", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.ReferenceGrant { return &v1alpha2.ReferenceGrant{} }, + func() *v1alpha2.ReferenceGrantList { return &v1alpha2.ReferenceGrantList{} }), } } - -// Get takes name of the referenceGrant, and returns the corresponding referenceGrant object, and an error if there is any. -func (c *referenceGrants) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.ReferenceGrant, err error) { - result = &v1alpha2.ReferenceGrant{} - err = c.client.Get(). - Namespace(c.ns). - Resource("referencegrants"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ReferenceGrants that match those selectors. -func (c *referenceGrants) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.ReferenceGrantList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.ReferenceGrantList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("referencegrants"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested referenceGrants. -func (c *referenceGrants) 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("referencegrants"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a referenceGrant and creates it. Returns the server's representation of the referenceGrant, and an error, if there is any. -func (c *referenceGrants) Create(ctx context.Context, referenceGrant *v1alpha2.ReferenceGrant, opts v1.CreateOptions) (result *v1alpha2.ReferenceGrant, err error) { - result = &v1alpha2.ReferenceGrant{} - err = c.client.Post(). - Namespace(c.ns). - Resource("referencegrants"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(referenceGrant). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a referenceGrant and updates it. Returns the server's representation of the referenceGrant, and an error, if there is any. -func (c *referenceGrants) Update(ctx context.Context, referenceGrant *v1alpha2.ReferenceGrant, opts v1.UpdateOptions) (result *v1alpha2.ReferenceGrant, err error) { - result = &v1alpha2.ReferenceGrant{} - err = c.client.Put(). - Namespace(c.ns). - Resource("referencegrants"). - Name(referenceGrant.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(referenceGrant). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the referenceGrant and deletes it. Returns an error if one occurs. -func (c *referenceGrants) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("referencegrants"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *referenceGrants) 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("referencegrants"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched referenceGrant. -func (c *referenceGrants) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.ReferenceGrant, err error) { - result = &v1alpha2.ReferenceGrant{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("referencegrants"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied referenceGrant. -func (c *referenceGrants) Apply(ctx context.Context, referenceGrant *apisv1alpha2.ReferenceGrantApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.ReferenceGrant, err error) { - if referenceGrant == nil { - return nil, fmt.Errorf("referenceGrant provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(referenceGrant) - if err != nil { - return nil, err - } - name := referenceGrant.Name - if name == nil { - return nil, fmt.Errorf("referenceGrant.Name must be provided to Apply") - } - result = &v1alpha2.ReferenceGrant{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("referencegrants"). - Name(*name). - VersionedParams(&patchOpts, 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/tcproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/tcproute.go index ffc6fa2ee8..9a9959cf7c 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/tcproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/tcproute.go @@ -20,14 +20,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type TCPRoutesGetter interface { type TCPRouteInterface interface { Create(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.CreateOptions) (*v1alpha2.TCPRoute, error) Update(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (*v1alpha2.TCPRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (*v1alpha2.TCPRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type TCPRouteInterface interface { 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.TCPRoute, err error) Apply(ctx context.Context, tCPRoute *apisv1alpha2.TCPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TCPRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, tCPRoute *apisv1alpha2.TCPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TCPRoute, err error) TCPRouteExpansion } // tCPRoutes implements TCPRouteInterface type tCPRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.TCPRoute, *v1alpha2.TCPRouteList, *apisv1alpha2.TCPRouteApplyConfiguration] } // newTCPRoutes returns a TCPRoutes func newTCPRoutes(c *GatewayV1alpha2Client, namespace string) *tCPRoutes { return &tCPRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.TCPRoute, *v1alpha2.TCPRouteList, *apisv1alpha2.TCPRouteApplyConfiguration]( + "tcproutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.TCPRoute { return &v1alpha2.TCPRoute{} }, + func() *v1alpha2.TCPRouteList { return &v1alpha2.TCPRouteList{} }), } } - -// Get takes name of the tCPRoute, and returns the corresponding tCPRoute object, and an error if there is any. -func (c *tCPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TCPRoute, err error) { - result = &v1alpha2.TCPRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tcproutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TCPRoutes that match those selectors. -func (c *tCPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TCPRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.TCPRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tcproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested tCPRoutes. -func (c *tCPRoutes) 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("tcproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a tCPRoute and creates it. Returns the server's representation of the tCPRoute, and an error, if there is any. -func (c *tCPRoutes) Create(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.CreateOptions) (result *v1alpha2.TCPRoute, err error) { - result = &v1alpha2.TCPRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("tcproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tCPRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a tCPRoute and updates it. Returns the server's representation of the tCPRoute, and an error, if there is any. -func (c *tCPRoutes) Update(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (result *v1alpha2.TCPRoute, err error) { - result = &v1alpha2.TCPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("tcproutes"). - Name(tCPRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tCPRoute). - 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 *tCPRoutes) UpdateStatus(ctx context.Context, tCPRoute *v1alpha2.TCPRoute, opts v1.UpdateOptions) (result *v1alpha2.TCPRoute, err error) { - result = &v1alpha2.TCPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("tcproutes"). - Name(tCPRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tCPRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the tCPRoute and deletes it. Returns an error if one occurs. -func (c *tCPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("tcproutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *tCPRoutes) 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("tcproutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched tCPRoute. -func (c *tCPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TCPRoute, err error) { - result = &v1alpha2.TCPRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("tcproutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied tCPRoute. -func (c *tCPRoutes) Apply(ctx context.Context, tCPRoute *apisv1alpha2.TCPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TCPRoute, err error) { - if tCPRoute == nil { - return nil, fmt.Errorf("tCPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(tCPRoute) - if err != nil { - return nil, err - } - name := tCPRoute.Name - if name == nil { - return nil, fmt.Errorf("tCPRoute.Name must be provided to Apply") - } - result = &v1alpha2.TCPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("tcproutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *tCPRoutes) ApplyStatus(ctx context.Context, tCPRoute *apisv1alpha2.TCPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TCPRoute, err error) { - if tCPRoute == nil { - return nil, fmt.Errorf("tCPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(tCPRoute) - if err != nil { - return nil, err - } - - name := tCPRoute.Name - if name == nil { - return nil, fmt.Errorf("tCPRoute.Name must be provided to Apply") - } - - result = &v1alpha2.TCPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("tcproutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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/tlsroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/tlsroute.go index 23719242fa..d98da0fbab 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/tlsroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/tlsroute.go @@ -20,14 +20,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type TLSRoutesGetter interface { type TLSRouteInterface interface { Create(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.CreateOptions) (*v1alpha2.TLSRoute, error) Update(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (*v1alpha2.TLSRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (*v1alpha2.TLSRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type TLSRouteInterface interface { 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.TLSRoute, err error) Apply(ctx context.Context, tLSRoute *apisv1alpha2.TLSRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TLSRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, tLSRoute *apisv1alpha2.TLSRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TLSRoute, err error) TLSRouteExpansion } // tLSRoutes implements TLSRouteInterface type tLSRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.TLSRoute, *v1alpha2.TLSRouteList, *apisv1alpha2.TLSRouteApplyConfiguration] } // newTLSRoutes returns a TLSRoutes func newTLSRoutes(c *GatewayV1alpha2Client, namespace string) *tLSRoutes { return &tLSRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.TLSRoute, *v1alpha2.TLSRouteList, *apisv1alpha2.TLSRouteApplyConfiguration]( + "tlsroutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.TLSRoute { return &v1alpha2.TLSRoute{} }, + func() *v1alpha2.TLSRouteList { return &v1alpha2.TLSRouteList{} }), } } - -// Get takes name of the tLSRoute, and returns the corresponding tLSRoute object, and an error if there is any. -func (c *tLSRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.TLSRoute, err error) { - result = &v1alpha2.TLSRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tlsroutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of TLSRoutes that match those selectors. -func (c *tLSRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.TLSRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.TLSRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("tlsroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested tLSRoutes. -func (c *tLSRoutes) 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("tlsroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a tLSRoute and creates it. Returns the server's representation of the tLSRoute, and an error, if there is any. -func (c *tLSRoutes) Create(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.CreateOptions) (result *v1alpha2.TLSRoute, err error) { - result = &v1alpha2.TLSRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("tlsroutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a tLSRoute and updates it. Returns the server's representation of the tLSRoute, and an error, if there is any. -func (c *tLSRoutes) Update(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (result *v1alpha2.TLSRoute, err error) { - result = &v1alpha2.TLSRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("tlsroutes"). - Name(tLSRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSRoute). - 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 *tLSRoutes) UpdateStatus(ctx context.Context, tLSRoute *v1alpha2.TLSRoute, opts v1.UpdateOptions) (result *v1alpha2.TLSRoute, err error) { - result = &v1alpha2.TLSRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("tlsroutes"). - Name(tLSRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(tLSRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the tLSRoute and deletes it. Returns an error if one occurs. -func (c *tLSRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("tlsroutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *tLSRoutes) 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("tlsroutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched tLSRoute. -func (c *tLSRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.TLSRoute, err error) { - result = &v1alpha2.TLSRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("tlsroutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied tLSRoute. -func (c *tLSRoutes) Apply(ctx context.Context, tLSRoute *apisv1alpha2.TLSRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TLSRoute, err error) { - if tLSRoute == nil { - return nil, fmt.Errorf("tLSRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(tLSRoute) - if err != nil { - return nil, err - } - name := tLSRoute.Name - if name == nil { - return nil, fmt.Errorf("tLSRoute.Name must be provided to Apply") - } - result = &v1alpha2.TLSRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("tlsroutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *tLSRoutes) ApplyStatus(ctx context.Context, tLSRoute *apisv1alpha2.TLSRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.TLSRoute, err error) { - if tLSRoute == nil { - return nil, fmt.Errorf("tLSRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(tLSRoute) - if err != nil { - return nil, err - } - - name := tLSRoute.Name - if name == nil { - return nil, fmt.Errorf("tLSRoute.Name must be provided to Apply") - } - - result = &v1alpha2.TLSRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("tlsroutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, 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/udproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/udproute.go index 3217a9004f..820bed9f31 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/udproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha2/udproute.go @@ -20,14 +20,11 @@ package v1alpha2 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha2 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha2" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type UDPRoutesGetter interface { type UDPRouteInterface interface { Create(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.CreateOptions) (*v1alpha2.UDPRoute, error) Update(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (*v1alpha2.UDPRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (*v1alpha2.UDPRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type UDPRouteInterface interface { 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.UDPRoute, err error) Apply(ctx context.Context, uDPRoute *apisv1alpha2.UDPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.UDPRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, uDPRoute *apisv1alpha2.UDPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.UDPRoute, err error) UDPRouteExpansion } // uDPRoutes implements UDPRouteInterface type uDPRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha2.UDPRoute, *v1alpha2.UDPRouteList, *apisv1alpha2.UDPRouteApplyConfiguration] } // newUDPRoutes returns a UDPRoutes func newUDPRoutes(c *GatewayV1alpha2Client, namespace string) *uDPRoutes { return &uDPRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha2.UDPRoute, *v1alpha2.UDPRouteList, *apisv1alpha2.UDPRouteApplyConfiguration]( + "udproutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha2.UDPRoute { return &v1alpha2.UDPRoute{} }, + func() *v1alpha2.UDPRouteList { return &v1alpha2.UDPRouteList{} }), } } - -// Get takes name of the uDPRoute, and returns the corresponding uDPRoute object, and an error if there is any. -func (c *uDPRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.UDPRoute, err error) { - result = &v1alpha2.UDPRoute{} - err = c.client.Get(). - Namespace(c.ns). - Resource("udproutes"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of UDPRoutes that match those selectors. -func (c *uDPRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.UDPRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha2.UDPRouteList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("udproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested uDPRoutes. -func (c *uDPRoutes) 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("udproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a uDPRoute and creates it. Returns the server's representation of the uDPRoute, and an error, if there is any. -func (c *uDPRoutes) Create(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.CreateOptions) (result *v1alpha2.UDPRoute, err error) { - result = &v1alpha2.UDPRoute{} - err = c.client.Post(). - Namespace(c.ns). - Resource("udproutes"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(uDPRoute). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a uDPRoute and updates it. Returns the server's representation of the uDPRoute, and an error, if there is any. -func (c *uDPRoutes) Update(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (result *v1alpha2.UDPRoute, err error) { - result = &v1alpha2.UDPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("udproutes"). - Name(uDPRoute.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(uDPRoute). - 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 *uDPRoutes) UpdateStatus(ctx context.Context, uDPRoute *v1alpha2.UDPRoute, opts v1.UpdateOptions) (result *v1alpha2.UDPRoute, err error) { - result = &v1alpha2.UDPRoute{} - err = c.client.Put(). - Namespace(c.ns). - Resource("udproutes"). - Name(uDPRoute.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(uDPRoute). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the uDPRoute and deletes it. Returns an error if one occurs. -func (c *uDPRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("udproutes"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *uDPRoutes) 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("udproutes"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched uDPRoute. -func (c *uDPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.UDPRoute, err error) { - result = &v1alpha2.UDPRoute{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("udproutes"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied uDPRoute. -func (c *uDPRoutes) Apply(ctx context.Context, uDPRoute *apisv1alpha2.UDPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.UDPRoute, err error) { - if uDPRoute == nil { - return nil, fmt.Errorf("uDPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(uDPRoute) - if err != nil { - return nil, err - } - name := uDPRoute.Name - if name == nil { - return nil, fmt.Errorf("uDPRoute.Name must be provided to Apply") - } - result = &v1alpha2.UDPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("udproutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *uDPRoutes) ApplyStatus(ctx context.Context, uDPRoute *apisv1alpha2.UDPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha2.UDPRoute, err error) { - if uDPRoute == nil { - return nil, fmt.Errorf("uDPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(uDPRoute) - if err != nil { - return nil, err - } - - name := uDPRoute.Name - if name == nil { - return nil, fmt.Errorf("uDPRoute.Name must be provided to Apply") - } - - result = &v1alpha2.UDPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("udproutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/backendtlspolicy.go index aecd62b6bb..3edd7e6279 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/backendtlspolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/backendtlspolicy.go @@ -20,14 +20,11 @@ package v1alpha3 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1alpha3 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1alpha3" v1alpha3 "sigs.k8s.io/gateway-api/apis/v1alpha3" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type BackendTLSPoliciesGetter interface { type BackendTLSPolicyInterface interface { Create(ctx context.Context, backendTLSPolicy *v1alpha3.BackendTLSPolicy, opts v1.CreateOptions) (*v1alpha3.BackendTLSPolicy, error) Update(ctx context.Context, backendTLSPolicy *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (*v1alpha3.BackendTLSPolicy, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, backendTLSPolicy *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (*v1alpha3.BackendTLSPolicy, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type BackendTLSPolicyInterface interface { 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 *v1alpha3.BackendTLSPolicy, err error) Apply(ctx context.Context, backendTLSPolicy *apisv1alpha3.BackendTLSPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha3.BackendTLSPolicy, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, backendTLSPolicy *apisv1alpha3.BackendTLSPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha3.BackendTLSPolicy, err error) BackendTLSPolicyExpansion } // backendTLSPolicies implements BackendTLSPolicyInterface type backendTLSPolicies struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1alpha3.BackendTLSPolicy, *v1alpha3.BackendTLSPolicyList, *apisv1alpha3.BackendTLSPolicyApplyConfiguration] } // newBackendTLSPolicies returns a BackendTLSPolicies func newBackendTLSPolicies(c *GatewayV1alpha3Client, namespace string) *backendTLSPolicies { return &backendTLSPolicies{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1alpha3.BackendTLSPolicy, *v1alpha3.BackendTLSPolicyList, *apisv1alpha3.BackendTLSPolicyApplyConfiguration]( + "backendtlspolicies", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha3.BackendTLSPolicy { return &v1alpha3.BackendTLSPolicy{} }, + func() *v1alpha3.BackendTLSPolicyList { return &v1alpha3.BackendTLSPolicyList{} }), } } - -// 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 *v1alpha3.BackendTLSPolicy, err error) { - result = &v1alpha3.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 *v1alpha3.BackendTLSPolicyList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha3.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 *v1alpha3.BackendTLSPolicy, opts v1.CreateOptions) (result *v1alpha3.BackendTLSPolicy, err error) { - result = &v1alpha3.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 *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha3.BackendTLSPolicy, err error) { - result = &v1alpha3.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 *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha3.BackendTLSPolicy, err error) { - result = &v1alpha3.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 *v1alpha3.BackendTLSPolicy, err error) { - result = &v1alpha3.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 -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied backendTLSPolicy. -func (c *backendTLSPolicies) Apply(ctx context.Context, backendTLSPolicy *apisv1alpha3.BackendTLSPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha3.BackendTLSPolicy, err error) { - if backendTLSPolicy == nil { - return nil, fmt.Errorf("backendTLSPolicy provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(backendTLSPolicy) - if err != nil { - return nil, err - } - name := backendTLSPolicy.Name - if name == nil { - return nil, fmt.Errorf("backendTLSPolicy.Name must be provided to Apply") - } - result = &v1alpha3.BackendTLSPolicy{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("backendtlspolicies"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *backendTLSPolicies) ApplyStatus(ctx context.Context, backendTLSPolicy *apisv1alpha3.BackendTLSPolicyApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha3.BackendTLSPolicy, err error) { - if backendTLSPolicy == nil { - return nil, fmt.Errorf("backendTLSPolicy provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(backendTLSPolicy) - if err != nil { - return nil, err - } - - name := backendTLSPolicy.Name - if name == nil { - return nil, fmt.Errorf("backendTLSPolicy.Name must be provided to Apply") - } - - result = &v1alpha3.BackendTLSPolicy{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("backendtlspolicies"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/fake/fake_backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/fake/fake_backendtlspolicy.go index 65ec24e635..042a931aea 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/fake/fake_backendtlspolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1alpha3/fake/fake_backendtlspolicy.go @@ -44,22 +44,24 @@ var backendtlspoliciesKind = v1alpha3.SchemeGroupVersion.WithKind("BackendTLSPol // 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 *v1alpha3.BackendTLSPolicy, err error) { + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewGetAction(backendtlspoliciesResource, c.ns, name), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewGetActionWithOptions(backendtlspoliciesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.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 *v1alpha3.BackendTLSPolicyList, err error) { + emptyResult := &v1alpha3.BackendTLSPolicyList{} obj, err := c.Fake. - Invokes(testing.NewListAction(backendtlspoliciesResource, backendtlspoliciesKind, c.ns, opts), &v1alpha3.BackendTLSPolicyList{}) + Invokes(testing.NewListActionWithOptions(backendtlspoliciesResource, backendtlspoliciesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeBackendTLSPolicies) List(ctx context.Context, opts v1.ListOptions) // 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)) + InvokesWatch(testing.NewWatchActionWithOptions(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 *v1alpha3.BackendTLSPolicy, opts v1.CreateOptions) (result *v1alpha3.BackendTLSPolicy, err error) { + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(backendtlspoliciesResource, c.ns, backendTLSPolicy), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewCreateActionWithOptions(backendtlspoliciesResource, c.ns, backendTLSPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.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 *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha3.BackendTLSPolicy, err error) { + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(backendtlspoliciesResource, c.ns, backendTLSPolicy), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewUpdateActionWithOptions(backendtlspoliciesResource, c.ns, backendTLSPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.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 *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (*v1alpha3.BackendTLSPolicy, error) { +func (c *FakeBackendTLSPolicies) UpdateStatus(ctx context.Context, backendTLSPolicy *v1alpha3.BackendTLSPolicy, opts v1.UpdateOptions) (result *v1alpha3.BackendTLSPolicy, err error) { + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(backendtlspoliciesResource, "status", c.ns, backendTLSPolicy), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(backendtlspoliciesResource, "status", c.ns, backendTLSPolicy, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.BackendTLSPolicy), err } @@ -126,7 +131,7 @@ func (c *FakeBackendTLSPolicies) Delete(ctx context.Context, name string, opts v // 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) + action := testing.NewDeleteCollectionActionWithOptions(backendtlspoliciesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1alpha3.BackendTLSPolicyList{}) return err @@ -134,11 +139,12 @@ func (c *FakeBackendTLSPolicies) DeleteCollection(ctx context.Context, opts v1.D // 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 *v1alpha3.BackendTLSPolicy, err error) { + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendtlspoliciesResource, c.ns, name, pt, data, subresources...), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtlspoliciesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.BackendTLSPolicy), err } @@ -156,11 +162,12 @@ func (c *FakeBackendTLSPolicies) Apply(ctx context.Context, backendTLSPolicy *ap if name == nil { return nil, fmt.Errorf("backendTLSPolicy.Name must be provided to Apply") } + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendtlspoliciesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtlspoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.BackendTLSPolicy), err } @@ -179,11 +186,12 @@ func (c *FakeBackendTLSPolicies) ApplyStatus(ctx context.Context, backendTLSPoli if name == nil { return nil, fmt.Errorf("backendTLSPolicy.Name must be provided to Apply") } + emptyResult := &v1alpha3.BackendTLSPolicy{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(backendtlspoliciesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha3.BackendTLSPolicy{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(backendtlspoliciesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1alpha3.BackendTLSPolicy), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go index e591318ced..757c95f11b 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gateway.go @@ -44,22 +44,24 @@ var gatewaysKind = v1beta1.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 v1.GetOptions) (result *v1beta1.Gateway, err error) { + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewGetAction(gatewaysResource, c.ns, name), &v1beta1.Gateway{}) + Invokes(testing.NewGetActionWithOptions(gatewaysResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 v1.ListOptions) (result *v1beta1.GatewayList, err error) { + emptyResult := &v1beta1.GatewayList{} obj, err := c.Fake. - Invokes(testing.NewListAction(gatewaysResource, gatewaysKind, c.ns, opts), &v1beta1.GatewayList{}) + Invokes(testing.NewListActionWithOptions(gatewaysResource, gatewaysKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeGateways) List(ctx context.Context, opts v1.ListOptions) (result *v // Watch returns a watch.Interface that watches the requested gateways. func (c *FakeGateways) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(gatewaysResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(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 *v1beta1.Gateway, opts v1.CreateOptions) (result *v1beta1.Gateway, err error) { + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(gatewaysResource, c.ns, gateway), &v1beta1.Gateway{}) + Invokes(testing.NewCreateActionWithOptions(gatewaysResource, c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(gatewaysResource, c.ns, gateway), &v1beta1.Gateway{}) + Invokes(testing.NewUpdateActionWithOptions(gatewaysResource, c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 *v1beta1.Gateway, opts v1.UpdateOptions) (*v1beta1.Gateway, error) { +func (c *FakeGateways) UpdateStatus(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(gatewaysResource, "status", c.ns, gateway), &v1beta1.Gateway{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(gatewaysResource, "status", c.ns, gateway, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Gateway), err } @@ -126,7 +131,7 @@ func (c *FakeGateways) Delete(ctx context.Context, name string, opts v1.DeleteOp // DeleteCollection deletes a collection of objects. func (c *FakeGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(gatewaysResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(gatewaysResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.GatewayList{}) return err @@ -134,11 +139,12 @@ func (c *FakeGateways) DeleteCollection(ctx context.Context, opts v1.DeleteOptio // Patch applies the patch and returns the patched gateway. func (c *FakeGateways) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.Gateway, err error) { + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, name, pt, data, subresources...), &v1beta1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Gateway), err } @@ -156,11 +162,12 @@ func (c *FakeGateways) Apply(ctx context.Context, gateway *apisv1beta1.GatewayAp if name == nil { return nil, fmt.Errorf("gateway.Name must be provided to Apply") } + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, *name, types.ApplyPatchType, data), &v1beta1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Gateway), err } @@ -179,11 +186,12 @@ func (c *FakeGateways) ApplyStatus(ctx context.Context, gateway *apisv1beta1.Gat if name == nil { return nil, fmt.Errorf("gateway.Name must be provided to Apply") } + emptyResult := &v1beta1.Gateway{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(gatewaysResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta1.Gateway{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(gatewaysResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.Gateway), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go index 4eb6d6a41f..0260974731 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_gatewayclass.go @@ -43,20 +43,22 @@ var gatewayclassesKind = v1beta1.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 v1.GetOptions) (result *v1beta1.GatewayClass, err error) { + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootGetAction(gatewayclassesResource, name), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootGetActionWithOptions(gatewayclassesResource, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 v1.ListOptions) (result *v1beta1.GatewayClassList, err error) { + emptyResult := &v1beta1.GatewayClassList{} obj, err := c.Fake. - Invokes(testing.NewRootListAction(gatewayclassesResource, gatewayclassesKind, opts), &v1beta1.GatewayClassList{}) + Invokes(testing.NewRootListActionWithOptions(gatewayclassesResource, gatewayclassesKind, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -75,36 +77,39 @@ func (c *FakeGatewayClasses) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested gatewayClasses. func (c *FakeGatewayClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewRootWatchAction(gatewayclassesResource, opts)) + InvokesWatch(testing.NewRootWatchActionWithOptions(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 *v1beta1.GatewayClass, opts v1.CreateOptions) (result *v1beta1.GatewayClass, err error) { + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootCreateAction(gatewayclassesResource, gatewayClass), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootCreateActionWithOptions(gatewayclassesResource, gatewayClass, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateAction(gatewayclassesResource, gatewayClass), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootUpdateActionWithOptions(gatewayclassesResource, gatewayClass, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 *v1beta1.GatewayClass, opts v1.UpdateOptions) (*v1beta1.GatewayClass, error) { +func (c *FakeGatewayClasses) UpdateStatus(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceAction(gatewayclassesResource, "status", gatewayClass), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootUpdateSubresourceActionWithOptions(gatewayclassesResource, "status", gatewayClass, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.GatewayClass), err } @@ -118,7 +123,7 @@ func (c *FakeGatewayClasses) Delete(ctx context.Context, name string, opts v1.De // DeleteCollection deletes a collection of objects. func (c *FakeGatewayClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewRootDeleteCollectionAction(gatewayclassesResource, listOpts) + action := testing.NewRootDeleteCollectionActionWithOptions(gatewayclassesResource, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.GatewayClassList{}) return err @@ -126,10 +131,11 @@ func (c *FakeGatewayClasses) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched gatewayClass. func (c *FakeGatewayClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayClass, err error) { + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, name, pt, data, subresources...), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(gatewayclassesResource, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.GatewayClass), err } @@ -147,10 +153,11 @@ func (c *FakeGatewayClasses) Apply(ctx context.Context, gatewayClass *apisv1beta if name == nil { return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") } + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, *name, types.ApplyPatchType, data), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(gatewayclassesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.GatewayClass), err } @@ -169,10 +176,11 @@ func (c *FakeGatewayClasses) ApplyStatus(ctx context.Context, gatewayClass *apis if name == nil { return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") } + emptyResult := &v1beta1.GatewayClass{} obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceAction(gatewayclassesResource, *name, types.ApplyPatchType, data, "status"), &v1beta1.GatewayClass{}) + Invokes(testing.NewRootPatchSubresourceActionWithOptions(gatewayclassesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.GatewayClass), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go index cae13dec84..75b4b7107b 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_httproute.go @@ -44,22 +44,24 @@ var httproutesKind = v1beta1.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 v1.GetOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewGetAction(httproutesResource, c.ns, name), &v1beta1.HTTPRoute{}) + Invokes(testing.NewGetActionWithOptions(httproutesResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 v1.ListOptions) (result *v1beta1.HTTPRouteList, err error) { + emptyResult := &v1beta1.HTTPRouteList{} obj, err := c.Fake. - Invokes(testing.NewListAction(httproutesResource, httproutesKind, c.ns, opts), &v1beta1.HTTPRouteList{}) + Invokes(testing.NewListActionWithOptions(httproutesResource, httproutesKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,40 +80,43 @@ func (c *FakeHTTPRoutes) List(ctx context.Context, opts v1.ListOptions) (result // Watch returns a watch.Interface that watches the requested hTTPRoutes. func (c *FakeHTTPRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(httproutesResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(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 *v1beta1.HTTPRoute, opts v1.CreateOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(httproutesResource, c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + Invokes(testing.NewCreateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(httproutesResource, c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + Invokes(testing.NewUpdateActionWithOptions(httproutesResource, c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.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 *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) { +func (c *FakeHTTPRoutes) UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(httproutesResource, "status", c.ns, hTTPRoute), &v1beta1.HTTPRoute{}) + Invokes(testing.NewUpdateSubresourceActionWithOptions(httproutesResource, "status", c.ns, hTTPRoute, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } @@ -126,7 +131,7 @@ func (c *FakeHTTPRoutes) Delete(ctx context.Context, name string, opts v1.Delete // DeleteCollection deletes a collection of objects. func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(httproutesResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(httproutesResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.HTTPRouteList{}) return err @@ -134,11 +139,12 @@ func (c *FakeHTTPRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOpt // Patch applies the patch and returns the patched hTTPRoute. func (c *FakeHTTPRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) { + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, name, pt, data, subresources...), &v1beta1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } @@ -156,11 +162,12 @@ func (c *FakeHTTPRoutes) Apply(ctx context.Context, hTTPRoute *apisv1beta1.HTTPR if name == nil { return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") } + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, *name, types.ApplyPatchType, data), &v1beta1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } @@ -179,11 +186,12 @@ func (c *FakeHTTPRoutes) ApplyStatus(ctx context.Context, hTTPRoute *apisv1beta1 if name == nil { return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") } + emptyResult := &v1beta1.HTTPRoute{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(httproutesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1beta1.HTTPRoute{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(httproutesResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.HTTPRoute), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_referencegrant.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_referencegrant.go index d6e31e827e..2f5daecf86 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/fake/fake_referencegrant.go @@ -44,22 +44,24 @@ var referencegrantsKind = v1beta1.SchemeGroupVersion.WithKind("ReferenceGrant") // Get takes name of the referenceGrant, and returns the corresponding referenceGrant object, and an error if there is any. func (c *FakeReferenceGrants) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ReferenceGrant, err error) { + emptyResult := &v1beta1.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewGetAction(referencegrantsResource, c.ns, name), &v1beta1.ReferenceGrant{}) + Invokes(testing.NewGetActionWithOptions(referencegrantsResource, c.ns, name, options), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ReferenceGrant), err } // List takes label and field selectors, and returns the list of ReferenceGrants that match those selectors. func (c *FakeReferenceGrants) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ReferenceGrantList, err error) { + emptyResult := &v1beta1.ReferenceGrantList{} obj, err := c.Fake. - Invokes(testing.NewListAction(referencegrantsResource, referencegrantsKind, c.ns, opts), &v1beta1.ReferenceGrantList{}) + Invokes(testing.NewListActionWithOptions(referencegrantsResource, referencegrantsKind, c.ns, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } label, _, _ := testing.ExtractFromListOptions(opts) @@ -78,28 +80,30 @@ func (c *FakeReferenceGrants) List(ctx context.Context, opts v1.ListOptions) (re // Watch returns a watch.Interface that watches the requested referenceGrants. func (c *FakeReferenceGrants) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(referencegrantsResource, c.ns, opts)) + InvokesWatch(testing.NewWatchActionWithOptions(referencegrantsResource, c.ns, opts)) } // Create takes the representation of a referenceGrant and creates it. Returns the server's representation of the referenceGrant, and an error, if there is any. func (c *FakeReferenceGrants) Create(ctx context.Context, referenceGrant *v1beta1.ReferenceGrant, opts v1.CreateOptions) (result *v1beta1.ReferenceGrant, err error) { + emptyResult := &v1beta1.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewCreateAction(referencegrantsResource, c.ns, referenceGrant), &v1beta1.ReferenceGrant{}) + Invokes(testing.NewCreateActionWithOptions(referencegrantsResource, c.ns, referenceGrant, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ReferenceGrant), err } // Update takes the representation of a referenceGrant and updates it. Returns the server's representation of the referenceGrant, and an error, if there is any. func (c *FakeReferenceGrants) Update(ctx context.Context, referenceGrant *v1beta1.ReferenceGrant, opts v1.UpdateOptions) (result *v1beta1.ReferenceGrant, err error) { + emptyResult := &v1beta1.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewUpdateAction(referencegrantsResource, c.ns, referenceGrant), &v1beta1.ReferenceGrant{}) + Invokes(testing.NewUpdateActionWithOptions(referencegrantsResource, c.ns, referenceGrant, opts), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ReferenceGrant), err } @@ -114,7 +118,7 @@ func (c *FakeReferenceGrants) Delete(ctx context.Context, name string, opts v1.D // DeleteCollection deletes a collection of objects. func (c *FakeReferenceGrants) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(referencegrantsResource, c.ns, listOpts) + action := testing.NewDeleteCollectionActionWithOptions(referencegrantsResource, c.ns, opts, listOpts) _, err := c.Fake.Invokes(action, &v1beta1.ReferenceGrantList{}) return err @@ -122,11 +126,12 @@ func (c *FakeReferenceGrants) DeleteCollection(ctx context.Context, opts v1.Dele // Patch applies the patch and returns the patched referenceGrant. func (c *FakeReferenceGrants) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ReferenceGrant, err error) { + emptyResult := &v1beta1.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(referencegrantsResource, c.ns, name, pt, data, subresources...), &v1beta1.ReferenceGrant{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(referencegrantsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ReferenceGrant), err } @@ -144,11 +149,12 @@ func (c *FakeReferenceGrants) Apply(ctx context.Context, referenceGrant *apisv1b if name == nil { return nil, fmt.Errorf("referenceGrant.Name must be provided to Apply") } + emptyResult := &v1beta1.ReferenceGrant{} obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(referencegrantsResource, c.ns, *name, types.ApplyPatchType, data), &v1beta1.ReferenceGrant{}) + Invokes(testing.NewPatchSubresourceActionWithOptions(referencegrantsResource, c.ns, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult) if obj == nil { - return nil, err + return emptyResult, err } return obj.(*v1beta1.ReferenceGrant), err } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go index ad54bccd57..6ed67c9955 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gateway.go @@ -20,14 +20,11 @@ package v1beta1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1beta1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type GatewaysGetter interface { type GatewayInterface interface { Create(ctx context.Context, gateway *v1beta1.Gateway, opts v1.CreateOptions) (*v1beta1.Gateway, error) Update(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (*v1beta1.Gateway, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, gateway *v1beta1.Gateway, opts v1.UpdateOptions) (*v1beta1.Gateway, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type GatewayInterface interface { 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 *v1beta1.Gateway, err error) Apply(ctx context.Context, gateway *apisv1beta1.GatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Gateway, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, gateway *apisv1beta1.GatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Gateway, err error) GatewayExpansion } // gateways implements GatewayInterface type gateways struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta1.Gateway, *v1beta1.GatewayList, *apisv1beta1.GatewayApplyConfiguration] } // newGateways returns a Gateways func newGateways(c *GatewayV1beta1Client, namespace string) *gateways { return &gateways{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta1.Gateway, *v1beta1.GatewayList, *apisv1beta1.GatewayApplyConfiguration]( + "gateways", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.Gateway { return &v1beta1.Gateway{} }, + func() *v1beta1.GatewayList { return &v1beta1.GatewayList{} }), } } - -// 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 v1.GetOptions) (result *v1beta1.Gateway, err error) { - result = &v1beta1.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 v1.ListOptions) (result *v1beta1.GatewayList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.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 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("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 *v1beta1.Gateway, opts v1.CreateOptions) (result *v1beta1.Gateway, err error) { - result = &v1beta1.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 *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { - result = &v1beta1.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 *v1beta1.Gateway, opts v1.UpdateOptions) (result *v1beta1.Gateway, err error) { - result = &v1beta1.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 v1.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 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("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 v1.PatchOptions, subresources ...string) (result *v1beta1.Gateway, err error) { - result = &v1beta1.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 -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied gateway. -func (c *gateways) Apply(ctx context.Context, gateway *apisv1beta1.GatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Gateway, err error) { - if gateway == nil { - return nil, fmt.Errorf("gateway provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gateway) - if err != nil { - return nil, err - } - name := gateway.Name - if name == nil { - return nil, fmt.Errorf("gateway.Name must be provided to Apply") - } - result = &v1beta1.Gateway{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("gateways"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *gateways) ApplyStatus(ctx context.Context, gateway *apisv1beta1.GatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.Gateway, err error) { - if gateway == nil { - return nil, fmt.Errorf("gateway provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gateway) - if err != nil { - return nil, err - } - - name := gateway.Name - if name == nil { - return nil, fmt.Errorf("gateway.Name must be provided to Apply") - } - - result = &v1beta1.Gateway{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("gateways"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go index 45bd5fcad0..f54b1e49be 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/gatewayclass.go @@ -20,14 +20,11 @@ package v1beta1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1beta1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type GatewayClassesGetter interface { type GatewayClassInterface interface { Create(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.CreateOptions) (*v1beta1.GatewayClass, error) Update(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (*v1beta1.GatewayClass, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, gatewayClass *v1beta1.GatewayClass, opts v1.UpdateOptions) (*v1beta1.GatewayClass, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,193 +49,25 @@ type GatewayClassInterface interface { 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 *v1beta1.GatewayClass, err error) Apply(ctx context.Context, gatewayClass *apisv1beta1.GatewayClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.GatewayClass, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, gatewayClass *apisv1beta1.GatewayClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.GatewayClass, err error) GatewayClassExpansion } // gatewayClasses implements GatewayClassInterface type gatewayClasses struct { - client rest.Interface + *gentype.ClientWithListAndApply[*v1beta1.GatewayClass, *v1beta1.GatewayClassList, *apisv1beta1.GatewayClassApplyConfiguration] } // newGatewayClasses returns a GatewayClasses func newGatewayClasses(c *GatewayV1beta1Client) *gatewayClasses { return &gatewayClasses{ - client: c.RESTClient(), + gentype.NewClientWithListAndApply[*v1beta1.GatewayClass, *v1beta1.GatewayClassList, *apisv1beta1.GatewayClassApplyConfiguration]( + "gatewayclasses", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *v1beta1.GatewayClass { return &v1beta1.GatewayClass{} }, + func() *v1beta1.GatewayClassList { return &v1beta1.GatewayClassList{} }), } } - -// 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 v1.GetOptions) (result *v1beta1.GatewayClass, err error) { - result = &v1beta1.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 v1.ListOptions) (result *v1beta1.GatewayClassList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.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 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(). - 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 *v1beta1.GatewayClass, opts v1.CreateOptions) (result *v1beta1.GatewayClass, err error) { - result = &v1beta1.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 *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { - result = &v1beta1.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 *v1beta1.GatewayClass, opts v1.UpdateOptions) (result *v1beta1.GatewayClass, err error) { - result = &v1beta1.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 v1.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 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(). - 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 v1.PatchOptions, subresources ...string) (result *v1beta1.GatewayClass, err error) { - result = &v1beta1.GatewayClass{} - err = c.client.Patch(pt). - Resource("gatewayclasses"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied gatewayClass. -func (c *gatewayClasses) Apply(ctx context.Context, gatewayClass *apisv1beta1.GatewayClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.GatewayClass, err error) { - if gatewayClass == nil { - return nil, fmt.Errorf("gatewayClass provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gatewayClass) - if err != nil { - return nil, err - } - name := gatewayClass.Name - if name == nil { - return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") - } - result = &v1beta1.GatewayClass{} - err = c.client.Patch(types.ApplyPatchType). - Resource("gatewayclasses"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *gatewayClasses) ApplyStatus(ctx context.Context, gatewayClass *apisv1beta1.GatewayClassApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.GatewayClass, err error) { - if gatewayClass == nil { - return nil, fmt.Errorf("gatewayClass provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(gatewayClass) - if err != nil { - return nil, err - } - - name := gatewayClass.Name - if name == nil { - return nil, fmt.Errorf("gatewayClass.Name must be provided to Apply") - } - - result = &v1beta1.GatewayClass{} - err = c.client.Patch(types.ApplyPatchType). - Resource("gatewayclasses"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go index a85262dca2..884a3d6108 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/httproute.go @@ -20,14 +20,11 @@ package v1beta1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1beta1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -43,6 +40,7 @@ type HTTPRoutesGetter interface { type HTTPRouteInterface interface { Create(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.CreateOptions) (*v1beta1.HTTPRoute, error) Update(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). UpdateStatus(ctx context.Context, hTTPRoute *v1beta1.HTTPRoute, opts v1.UpdateOptions) (*v1beta1.HTTPRoute, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error @@ -51,206 +49,25 @@ type HTTPRouteInterface interface { 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 *v1beta1.HTTPRoute, err error) Apply(ctx context.Context, hTTPRoute *apisv1beta1.HTTPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.HTTPRoute, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). ApplyStatus(ctx context.Context, hTTPRoute *apisv1beta1.HTTPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.HTTPRoute, err error) HTTPRouteExpansion } // hTTPRoutes implements HTTPRouteInterface type hTTPRoutes struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta1.HTTPRoute, *v1beta1.HTTPRouteList, *apisv1beta1.HTTPRouteApplyConfiguration] } // newHTTPRoutes returns a HTTPRoutes func newHTTPRoutes(c *GatewayV1beta1Client, namespace string) *hTTPRoutes { return &hTTPRoutes{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta1.HTTPRoute, *v1beta1.HTTPRouteList, *apisv1beta1.HTTPRouteApplyConfiguration]( + "httproutes", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.HTTPRoute { return &v1beta1.HTTPRoute{} }, + func() *v1beta1.HTTPRouteList { return &v1beta1.HTTPRouteList{} }), } } - -// 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 v1.GetOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.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 v1.ListOptions) (result *v1beta1.HTTPRouteList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.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 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("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 *v1beta1.HTTPRoute, opts v1.CreateOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.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 *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.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 *v1beta1.HTTPRoute, opts v1.UpdateOptions) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.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 v1.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 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("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 v1.PatchOptions, subresources ...string) (result *v1beta1.HTTPRoute, err error) { - result = &v1beta1.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 -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied hTTPRoute. -func (c *hTTPRoutes) Apply(ctx context.Context, hTTPRoute *apisv1beta1.HTTPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.HTTPRoute, err error) { - if hTTPRoute == nil { - return nil, fmt.Errorf("hTTPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(hTTPRoute) - if err != nil { - return nil, err - } - name := hTTPRoute.Name - if name == nil { - return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") - } - result = &v1beta1.HTTPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("httproutes"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// ApplyStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *hTTPRoutes) ApplyStatus(ctx context.Context, hTTPRoute *apisv1beta1.HTTPRouteApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.HTTPRoute, err error) { - if hTTPRoute == nil { - return nil, fmt.Errorf("hTTPRoute provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(hTTPRoute) - if err != nil { - return nil, err - } - - name := hTTPRoute.Name - if name == nil { - return nil, fmt.Errorf("hTTPRoute.Name must be provided to Apply") - } - - result = &v1beta1.HTTPRoute{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("httproutes"). - Name(*name). - SubResource("status"). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/referencegrant.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/referencegrant.go index 575bbd4c05..992727e305 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1beta1/referencegrant.go @@ -20,14 +20,11 @@ package v1beta1 import ( "context" - json "encoding/json" - "fmt" - "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" + gentype "k8s.io/client-go/gentype" apisv1beta1 "sigs.k8s.io/gateway-api/apis/applyconfiguration/apis/v1beta1" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" scheme "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/scheme" @@ -55,154 +52,18 @@ type ReferenceGrantInterface interface { // referenceGrants implements ReferenceGrantInterface type referenceGrants struct { - client rest.Interface - ns string + *gentype.ClientWithListAndApply[*v1beta1.ReferenceGrant, *v1beta1.ReferenceGrantList, *apisv1beta1.ReferenceGrantApplyConfiguration] } // newReferenceGrants returns a ReferenceGrants func newReferenceGrants(c *GatewayV1beta1Client, namespace string) *referenceGrants { return &referenceGrants{ - client: c.RESTClient(), - ns: namespace, + gentype.NewClientWithListAndApply[*v1beta1.ReferenceGrant, *v1beta1.ReferenceGrantList, *apisv1beta1.ReferenceGrantApplyConfiguration]( + "referencegrants", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1beta1.ReferenceGrant { return &v1beta1.ReferenceGrant{} }, + func() *v1beta1.ReferenceGrantList { return &v1beta1.ReferenceGrantList{} }), } } - -// Get takes name of the referenceGrant, and returns the corresponding referenceGrant object, and an error if there is any. -func (c *referenceGrants) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ReferenceGrant, err error) { - result = &v1beta1.ReferenceGrant{} - err = c.client.Get(). - Namespace(c.ns). - Resource("referencegrants"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ReferenceGrants that match those selectors. -func (c *referenceGrants) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ReferenceGrantList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ReferenceGrantList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("referencegrants"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested referenceGrants. -func (c *referenceGrants) 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("referencegrants"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a referenceGrant and creates it. Returns the server's representation of the referenceGrant, and an error, if there is any. -func (c *referenceGrants) Create(ctx context.Context, referenceGrant *v1beta1.ReferenceGrant, opts v1.CreateOptions) (result *v1beta1.ReferenceGrant, err error) { - result = &v1beta1.ReferenceGrant{} - err = c.client.Post(). - Namespace(c.ns). - Resource("referencegrants"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(referenceGrant). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a referenceGrant and updates it. Returns the server's representation of the referenceGrant, and an error, if there is any. -func (c *referenceGrants) Update(ctx context.Context, referenceGrant *v1beta1.ReferenceGrant, opts v1.UpdateOptions) (result *v1beta1.ReferenceGrant, err error) { - result = &v1beta1.ReferenceGrant{} - err = c.client.Put(). - Namespace(c.ns). - Resource("referencegrants"). - Name(referenceGrant.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(referenceGrant). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the referenceGrant and deletes it. Returns an error if one occurs. -func (c *referenceGrants) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("referencegrants"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *referenceGrants) 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("referencegrants"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched referenceGrant. -func (c *referenceGrants) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ReferenceGrant, err error) { - result = &v1beta1.ReferenceGrant{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("referencegrants"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} - -// Apply takes the given apply declarative configuration, applies it and returns the applied referenceGrant. -func (c *referenceGrants) Apply(ctx context.Context, referenceGrant *apisv1beta1.ReferenceGrantApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ReferenceGrant, err error) { - if referenceGrant == nil { - return nil, fmt.Errorf("referenceGrant provided to Apply must not be nil") - } - patchOpts := opts.ToPatchOptions() - data, err := json.Marshal(referenceGrant) - if err != nil { - return nil, err - } - name := referenceGrant.Name - if name == nil { - return nil, fmt.Errorf("referenceGrant.Name must be provided to Apply") - } - result = &v1beta1.ReferenceGrant{} - err = c.client.Patch(types.ApplyPatchType). - Namespace(c.ns). - Resource("referencegrants"). - Name(*name). - VersionedParams(&patchOpts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/factory.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/factory.go index e7f08e89f1..0f5f0550c8 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/factory.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/informers/externalversions/factory.go @@ -228,6 +228,7 @@ type SharedInformerFactory interface { // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. + // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. Start(stopCh <-chan struct{}) // Shutdown marks a factory as shutting down. At that point no new 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 index 82a886c86c..a709b86266 100644 --- 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 @@ -19,8 +19,8 @@ limitations under the License. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "sigs.k8s.io/gateway-api/apis/v1" ) @@ -38,25 +38,17 @@ type GatewayLister interface { // gatewayLister implements the GatewayLister interface. type gatewayLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.Gateway] } // 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 + return &gatewayLister{listers.New[*v1.Gateway](indexer, v1.Resource("gateway"))} } // Gateways returns an object that can list and get Gateways. func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { - return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace} + return gatewayNamespaceLister{listers.NewNamespaced[*v1.Gateway](s.ResourceIndexer, namespace)} } // GatewayNamespaceLister helps list and get Gateways. @@ -74,26 +66,5 @@ type GatewayNamespaceLister interface { // 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 + listers.ResourceIndexer[*v1.Gateway] } 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 index e3ddf47e27..477e91983d 100644 --- 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 @@ -19,8 +19,8 @@ limitations under the License. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "sigs.k8s.io/gateway-api/apis/v1" ) @@ -39,30 +39,10 @@ type GatewayClassLister interface { // gatewayClassLister implements the GatewayClassLister interface. type gatewayClassLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.GatewayClass] } // 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 + return &gatewayClassLister{listers.New[*v1.GatewayClass](indexer, v1.Resource("gatewayclass"))} } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/grpcroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/grpcroute.go index 5859b59a10..0409c9a402 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1/grpcroute.go @@ -19,8 +19,8 @@ limitations under the License. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "sigs.k8s.io/gateway-api/apis/v1" ) @@ -38,25 +38,17 @@ type GRPCRouteLister interface { // gRPCRouteLister implements the GRPCRouteLister interface. type gRPCRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.GRPCRoute] } // NewGRPCRouteLister returns a new GRPCRouteLister. func NewGRPCRouteLister(indexer cache.Indexer) GRPCRouteLister { - return &gRPCRouteLister{indexer: indexer} -} - -// List lists all GRPCRoutes in the indexer. -func (s *gRPCRouteLister) List(selector labels.Selector) (ret []*v1.GRPCRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1.GRPCRoute)) - }) - return ret, err + return &gRPCRouteLister{listers.New[*v1.GRPCRoute](indexer, v1.Resource("grpcroute"))} } // GRPCRoutes returns an object that can list and get GRPCRoutes. func (s *gRPCRouteLister) GRPCRoutes(namespace string) GRPCRouteNamespaceLister { - return gRPCRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return gRPCRouteNamespaceLister{listers.NewNamespaced[*v1.GRPCRoute](s.ResourceIndexer, namespace)} } // GRPCRouteNamespaceLister helps list and get GRPCRoutes. @@ -74,26 +66,5 @@ type GRPCRouteNamespaceLister interface { // gRPCRouteNamespaceLister implements the GRPCRouteNamespaceLister // interface. type gRPCRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all GRPCRoutes in the indexer for a given namespace. -func (s gRPCRouteNamespaceLister) List(selector labels.Selector) (ret []*v1.GRPCRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1.GRPCRoute)) - }) - return ret, err -} - -// Get retrieves the GRPCRoute from the indexer for a given namespace and name. -func (s gRPCRouteNamespaceLister) Get(name string) (*v1.GRPCRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1.Resource("grpcroute"), name) - } - return obj.(*v1.GRPCRoute), nil + listers.ResourceIndexer[*v1.GRPCRoute] } 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 index edf16efc5f..2cbbe09d94 100644 --- 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 @@ -19,8 +19,8 @@ limitations under the License. package v1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1 "sigs.k8s.io/gateway-api/apis/v1" ) @@ -38,25 +38,17 @@ type HTTPRouteLister interface { // hTTPRouteLister implements the HTTPRouteLister interface. type hTTPRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1.HTTPRoute] } // 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 + return &hTTPRouteLister{listers.New[*v1.HTTPRoute](indexer, v1.Resource("httproute"))} } // HTTPRoutes returns an object that can list and get HTTPRoutes. func (s *hTTPRouteLister) HTTPRoutes(namespace string) HTTPRouteNamespaceLister { - return hTTPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPRouteNamespaceLister{listers.NewNamespaced[*v1.HTTPRoute](s.ResourceIndexer, namespace)} } // HTTPRouteNamespaceLister helps list and get HTTPRoutes. @@ -74,26 +66,5 @@ type HTTPRouteNamespaceLister interface { // 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 + listers.ResourceIndexer[*v1.HTTPRoute] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendlbpolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendlbpolicy.go index 1b01f4ec3f..3b09cd2d43 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendlbpolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/backendlbpolicy.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) @@ -38,25 +38,17 @@ type BackendLBPolicyLister interface { // backendLBPolicyLister implements the BackendLBPolicyLister interface. type backendLBPolicyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.BackendLBPolicy] } // NewBackendLBPolicyLister returns a new BackendLBPolicyLister. func NewBackendLBPolicyLister(indexer cache.Indexer) BackendLBPolicyLister { - return &backendLBPolicyLister{indexer: indexer} -} - -// List lists all BackendLBPolicies in the indexer. -func (s *backendLBPolicyLister) List(selector labels.Selector) (ret []*v1alpha2.BackendLBPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.BackendLBPolicy)) - }) - return ret, err + return &backendLBPolicyLister{listers.New[*v1alpha2.BackendLBPolicy](indexer, v1alpha2.Resource("backendlbpolicy"))} } // BackendLBPolicies returns an object that can list and get BackendLBPolicies. func (s *backendLBPolicyLister) BackendLBPolicies(namespace string) BackendLBPolicyNamespaceLister { - return backendLBPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} + return backendLBPolicyNamespaceLister{listers.NewNamespaced[*v1alpha2.BackendLBPolicy](s.ResourceIndexer, namespace)} } // BackendLBPolicyNamespaceLister helps list and get BackendLBPolicies. @@ -74,26 +66,5 @@ type BackendLBPolicyNamespaceLister interface { // backendLBPolicyNamespaceLister implements the BackendLBPolicyNamespaceLister // interface. type backendLBPolicyNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all BackendLBPolicies in the indexer for a given namespace. -func (s backendLBPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.BackendLBPolicy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.BackendLBPolicy)) - }) - return ret, err -} - -// Get retrieves the BackendLBPolicy from the indexer for a given namespace and name. -func (s backendLBPolicyNamespaceLister) Get(name string) (*v1alpha2.BackendLBPolicy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("backendlbpolicy"), name) - } - return obj.(*v1alpha2.BackendLBPolicy), nil + listers.ResourceIndexer[*v1alpha2.BackendLBPolicy] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/grpcroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/grpcroute.go index 822cddba97..9ec44ce2b3 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/grpcroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/grpcroute.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) @@ -38,25 +38,17 @@ type GRPCRouteLister interface { // gRPCRouteLister implements the GRPCRouteLister interface. type gRPCRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.GRPCRoute] } // NewGRPCRouteLister returns a new GRPCRouteLister. func NewGRPCRouteLister(indexer cache.Indexer) GRPCRouteLister { - return &gRPCRouteLister{indexer: indexer} -} - -// List lists all GRPCRoutes in the indexer. -func (s *gRPCRouteLister) List(selector labels.Selector) (ret []*v1alpha2.GRPCRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.GRPCRoute)) - }) - return ret, err + return &gRPCRouteLister{listers.New[*v1alpha2.GRPCRoute](indexer, v1alpha2.Resource("grpcroute"))} } // GRPCRoutes returns an object that can list and get GRPCRoutes. func (s *gRPCRouteLister) GRPCRoutes(namespace string) GRPCRouteNamespaceLister { - return gRPCRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return gRPCRouteNamespaceLister{listers.NewNamespaced[*v1alpha2.GRPCRoute](s.ResourceIndexer, namespace)} } // GRPCRouteNamespaceLister helps list and get GRPCRoutes. @@ -74,26 +66,5 @@ type GRPCRouteNamespaceLister interface { // gRPCRouteNamespaceLister implements the GRPCRouteNamespaceLister // interface. type gRPCRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all GRPCRoutes in the indexer for a given namespace. -func (s gRPCRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.GRPCRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.GRPCRoute)) - }) - return ret, err -} - -// Get retrieves the GRPCRoute from the indexer for a given namespace and name. -func (s gRPCRouteNamespaceLister) Get(name string) (*v1alpha2.GRPCRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("grpcroute"), name) - } - return obj.(*v1alpha2.GRPCRoute), nil + listers.ResourceIndexer[*v1alpha2.GRPCRoute] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/referencegrant.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/referencegrant.go index eb8c7a5615..8df80e9252 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/referencegrant.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) @@ -38,25 +38,17 @@ type ReferenceGrantLister interface { // referenceGrantLister implements the ReferenceGrantLister interface. type referenceGrantLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.ReferenceGrant] } // NewReferenceGrantLister returns a new ReferenceGrantLister. func NewReferenceGrantLister(indexer cache.Indexer) ReferenceGrantLister { - return &referenceGrantLister{indexer: indexer} -} - -// List lists all ReferenceGrants in the indexer. -func (s *referenceGrantLister) List(selector labels.Selector) (ret []*v1alpha2.ReferenceGrant, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ReferenceGrant)) - }) - return ret, err + return &referenceGrantLister{listers.New[*v1alpha2.ReferenceGrant](indexer, v1alpha2.Resource("referencegrant"))} } // ReferenceGrants returns an object that can list and get ReferenceGrants. func (s *referenceGrantLister) ReferenceGrants(namespace string) ReferenceGrantNamespaceLister { - return referenceGrantNamespaceLister{indexer: s.indexer, namespace: namespace} + return referenceGrantNamespaceLister{listers.NewNamespaced[*v1alpha2.ReferenceGrant](s.ResourceIndexer, namespace)} } // ReferenceGrantNamespaceLister helps list and get ReferenceGrants. @@ -74,26 +66,5 @@ type ReferenceGrantNamespaceLister interface { // referenceGrantNamespaceLister implements the ReferenceGrantNamespaceLister // interface. type referenceGrantNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ReferenceGrants in the indexer for a given namespace. -func (s referenceGrantNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.ReferenceGrant, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.ReferenceGrant)) - }) - return ret, err -} - -// Get retrieves the ReferenceGrant from the indexer for a given namespace and name. -func (s referenceGrantNamespaceLister) Get(name string) (*v1alpha2.ReferenceGrant, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("referencegrant"), name) - } - return obj.(*v1alpha2.ReferenceGrant), nil + listers.ResourceIndexer[*v1alpha2.ReferenceGrant] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tcproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tcproute.go index f9582ed03e..4b34f9a2d9 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tcproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tcproute.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) @@ -38,25 +38,17 @@ type TCPRouteLister interface { // tCPRouteLister implements the TCPRouteLister interface. type tCPRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.TCPRoute] } // NewTCPRouteLister returns a new TCPRouteLister. func NewTCPRouteLister(indexer cache.Indexer) TCPRouteLister { - return &tCPRouteLister{indexer: indexer} -} - -// List lists all TCPRoutes in the indexer. -func (s *tCPRouteLister) List(selector labels.Selector) (ret []*v1alpha2.TCPRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TCPRoute)) - }) - return ret, err + return &tCPRouteLister{listers.New[*v1alpha2.TCPRoute](indexer, v1alpha2.Resource("tcproute"))} } // TCPRoutes returns an object that can list and get TCPRoutes. func (s *tCPRouteLister) TCPRoutes(namespace string) TCPRouteNamespaceLister { - return tCPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return tCPRouteNamespaceLister{listers.NewNamespaced[*v1alpha2.TCPRoute](s.ResourceIndexer, namespace)} } // TCPRouteNamespaceLister helps list and get TCPRoutes. @@ -74,26 +66,5 @@ type TCPRouteNamespaceLister interface { // tCPRouteNamespaceLister implements the TCPRouteNamespaceLister // interface. type tCPRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TCPRoutes in the indexer for a given namespace. -func (s tCPRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.TCPRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TCPRoute)) - }) - return ret, err -} - -// Get retrieves the TCPRoute from the indexer for a given namespace and name. -func (s tCPRouteNamespaceLister) Get(name string) (*v1alpha2.TCPRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("tcproute"), name) - } - return obj.(*v1alpha2.TCPRoute), nil + listers.ResourceIndexer[*v1alpha2.TCPRoute] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tlsroute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tlsroute.go index 0c68c2e71f..ad021d0d14 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tlsroute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/tlsroute.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) @@ -38,25 +38,17 @@ type TLSRouteLister interface { // tLSRouteLister implements the TLSRouteLister interface. type tLSRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.TLSRoute] } // NewTLSRouteLister returns a new TLSRouteLister. func NewTLSRouteLister(indexer cache.Indexer) TLSRouteLister { - return &tLSRouteLister{indexer: indexer} -} - -// List lists all TLSRoutes in the indexer. -func (s *tLSRouteLister) List(selector labels.Selector) (ret []*v1alpha2.TLSRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TLSRoute)) - }) - return ret, err + return &tLSRouteLister{listers.New[*v1alpha2.TLSRoute](indexer, v1alpha2.Resource("tlsroute"))} } // TLSRoutes returns an object that can list and get TLSRoutes. func (s *tLSRouteLister) TLSRoutes(namespace string) TLSRouteNamespaceLister { - return tLSRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return tLSRouteNamespaceLister{listers.NewNamespaced[*v1alpha2.TLSRoute](s.ResourceIndexer, namespace)} } // TLSRouteNamespaceLister helps list and get TLSRoutes. @@ -74,26 +66,5 @@ type TLSRouteNamespaceLister interface { // tLSRouteNamespaceLister implements the TLSRouteNamespaceLister // interface. type tLSRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all TLSRoutes in the indexer for a given namespace. -func (s tLSRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.TLSRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.TLSRoute)) - }) - return ret, err -} - -// Get retrieves the TLSRoute from the indexer for a given namespace and name. -func (s tLSRouteNamespaceLister) Get(name string) (*v1alpha2.TLSRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("tlsroute"), name) - } - return obj.(*v1alpha2.TLSRoute), nil + listers.ResourceIndexer[*v1alpha2.TLSRoute] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/udproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/udproute.go index ef47d5a105..e4e4a20643 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/udproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha2/udproute.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha2 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) @@ -38,25 +38,17 @@ type UDPRouteLister interface { // uDPRouteLister implements the UDPRouteLister interface. type uDPRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha2.UDPRoute] } // NewUDPRouteLister returns a new UDPRouteLister. func NewUDPRouteLister(indexer cache.Indexer) UDPRouteLister { - return &uDPRouteLister{indexer: indexer} -} - -// List lists all UDPRoutes in the indexer. -func (s *uDPRouteLister) List(selector labels.Selector) (ret []*v1alpha2.UDPRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.UDPRoute)) - }) - return ret, err + return &uDPRouteLister{listers.New[*v1alpha2.UDPRoute](indexer, v1alpha2.Resource("udproute"))} } // UDPRoutes returns an object that can list and get UDPRoutes. func (s *uDPRouteLister) UDPRoutes(namespace string) UDPRouteNamespaceLister { - return uDPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return uDPRouteNamespaceLister{listers.NewNamespaced[*v1alpha2.UDPRoute](s.ResourceIndexer, namespace)} } // UDPRouteNamespaceLister helps list and get UDPRoutes. @@ -74,26 +66,5 @@ type UDPRouteNamespaceLister interface { // uDPRouteNamespaceLister implements the UDPRouteNamespaceLister // interface. type uDPRouteNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all UDPRoutes in the indexer for a given namespace. -func (s uDPRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.UDPRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.UDPRoute)) - }) - return ret, err -} - -// Get retrieves the UDPRoute from the indexer for a given namespace and name. -func (s uDPRouteNamespaceLister) Get(name string) (*v1alpha2.UDPRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("udproute"), name) - } - return obj.(*v1alpha2.UDPRoute), nil + listers.ResourceIndexer[*v1alpha2.UDPRoute] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha3/backendtlspolicy.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha3/backendtlspolicy.go index 56ea817373..c881c849f4 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha3/backendtlspolicy.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1alpha3/backendtlspolicy.go @@ -19,8 +19,8 @@ limitations under the License. package v1alpha3 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1alpha3 "sigs.k8s.io/gateway-api/apis/v1alpha3" ) @@ -38,25 +38,17 @@ type BackendTLSPolicyLister interface { // backendTLSPolicyLister implements the BackendTLSPolicyLister interface. type backendTLSPolicyLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1alpha3.BackendTLSPolicy] } // 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 []*v1alpha3.BackendTLSPolicy, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.BackendTLSPolicy)) - }) - return ret, err + return &backendTLSPolicyLister{listers.New[*v1alpha3.BackendTLSPolicy](indexer, v1alpha3.Resource("backendtlspolicy"))} } // BackendTLSPolicies returns an object that can list and get BackendTLSPolicies. func (s *backendTLSPolicyLister) BackendTLSPolicies(namespace string) BackendTLSPolicyNamespaceLister { - return backendTLSPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} + return backendTLSPolicyNamespaceLister{listers.NewNamespaced[*v1alpha3.BackendTLSPolicy](s.ResourceIndexer, namespace)} } // BackendTLSPolicyNamespaceLister helps list and get BackendTLSPolicies. @@ -74,26 +66,5 @@ type BackendTLSPolicyNamespaceLister interface { // 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 []*v1alpha3.BackendTLSPolicy, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha3.BackendTLSPolicy)) - }) - return ret, err -} - -// Get retrieves the BackendTLSPolicy from the indexer for a given namespace and name. -func (s backendTLSPolicyNamespaceLister) Get(name string) (*v1alpha3.BackendTLSPolicy, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha3.Resource("backendtlspolicy"), name) - } - return obj.(*v1alpha3.BackendTLSPolicy), nil + listers.ResourceIndexer[*v1alpha3.BackendTLSPolicy] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gateway.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gateway.go index 34a6707cb0..2b20013c17 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gateway.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gateway.go @@ -19,8 +19,8 @@ limitations under the License. package v1beta1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -38,25 +38,17 @@ type GatewayLister interface { // gatewayLister implements the GatewayLister interface. type gatewayLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.Gateway] } // 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 []*v1beta1.Gateway, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Gateway)) - }) - return ret, err + return &gatewayLister{listers.New[*v1beta1.Gateway](indexer, v1beta1.Resource("gateway"))} } // Gateways returns an object that can list and get Gateways. func (s *gatewayLister) Gateways(namespace string) GatewayNamespaceLister { - return gatewayNamespaceLister{indexer: s.indexer, namespace: namespace} + return gatewayNamespaceLister{listers.NewNamespaced[*v1beta1.Gateway](s.ResourceIndexer, namespace)} } // GatewayNamespaceLister helps list and get Gateways. @@ -74,26 +66,5 @@ type GatewayNamespaceLister interface { // 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 []*v1beta1.Gateway, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Gateway)) - }) - return ret, err -} - -// Get retrieves the Gateway from the indexer for a given namespace and name. -func (s gatewayNamespaceLister) Get(name string) (*v1beta1.Gateway, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("gateway"), name) - } - return obj.(*v1beta1.Gateway), nil + listers.ResourceIndexer[*v1beta1.Gateway] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gatewayclass.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gatewayclass.go index 2161270142..c2ae2ec025 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gatewayclass.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/gatewayclass.go @@ -19,8 +19,8 @@ limitations under the License. package v1beta1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -39,30 +39,10 @@ type GatewayClassLister interface { // gatewayClassLister implements the GatewayClassLister interface. type gatewayClassLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.GatewayClass] } // 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 []*v1beta1.GatewayClass, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.GatewayClass)) - }) - return ret, err -} - -// Get retrieves the GatewayClass from the index for a given name. -func (s *gatewayClassLister) Get(name string) (*v1beta1.GatewayClass, error) { - obj, exists, err := s.indexer.GetByKey(name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("gatewayclass"), name) - } - return obj.(*v1beta1.GatewayClass), nil + return &gatewayClassLister{listers.New[*v1beta1.GatewayClass](indexer, v1beta1.Resource("gatewayclass"))} } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/httproute.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/httproute.go index 6d27a03358..243226986c 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/httproute.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/httproute.go @@ -19,8 +19,8 @@ limitations under the License. package v1beta1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -38,25 +38,17 @@ type HTTPRouteLister interface { // hTTPRouteLister implements the HTTPRouteLister interface. type hTTPRouteLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.HTTPRoute] } // 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 []*v1beta1.HTTPRoute, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.HTTPRoute)) - }) - return ret, err + return &hTTPRouteLister{listers.New[*v1beta1.HTTPRoute](indexer, v1beta1.Resource("httproute"))} } // HTTPRoutes returns an object that can list and get HTTPRoutes. func (s *hTTPRouteLister) HTTPRoutes(namespace string) HTTPRouteNamespaceLister { - return hTTPRouteNamespaceLister{indexer: s.indexer, namespace: namespace} + return hTTPRouteNamespaceLister{listers.NewNamespaced[*v1beta1.HTTPRoute](s.ResourceIndexer, namespace)} } // HTTPRouteNamespaceLister helps list and get HTTPRoutes. @@ -74,26 +66,5 @@ type HTTPRouteNamespaceLister interface { // 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 []*v1beta1.HTTPRoute, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.HTTPRoute)) - }) - return ret, err -} - -// Get retrieves the HTTPRoute from the indexer for a given namespace and name. -func (s hTTPRouteNamespaceLister) Get(name string) (*v1beta1.HTTPRoute, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("httproute"), name) - } - return obj.(*v1beta1.HTTPRoute), nil + listers.ResourceIndexer[*v1beta1.HTTPRoute] } diff --git a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/referencegrant.go b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/referencegrant.go index 8144734b27..5263fef653 100644 --- a/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/referencegrant.go +++ b/vendor/sigs.k8s.io/gateway-api/pkg/client/listers/apis/v1beta1/referencegrant.go @@ -19,8 +19,8 @@ limitations under the License. package v1beta1 import ( - "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" v1beta1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -38,25 +38,17 @@ type ReferenceGrantLister interface { // referenceGrantLister implements the ReferenceGrantLister interface. type referenceGrantLister struct { - indexer cache.Indexer + listers.ResourceIndexer[*v1beta1.ReferenceGrant] } // NewReferenceGrantLister returns a new ReferenceGrantLister. func NewReferenceGrantLister(indexer cache.Indexer) ReferenceGrantLister { - return &referenceGrantLister{indexer: indexer} -} - -// List lists all ReferenceGrants in the indexer. -func (s *referenceGrantLister) List(selector labels.Selector) (ret []*v1beta1.ReferenceGrant, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ReferenceGrant)) - }) - return ret, err + return &referenceGrantLister{listers.New[*v1beta1.ReferenceGrant](indexer, v1beta1.Resource("referencegrant"))} } // ReferenceGrants returns an object that can list and get ReferenceGrants. func (s *referenceGrantLister) ReferenceGrants(namespace string) ReferenceGrantNamespaceLister { - return referenceGrantNamespaceLister{indexer: s.indexer, namespace: namespace} + return referenceGrantNamespaceLister{listers.NewNamespaced[*v1beta1.ReferenceGrant](s.ResourceIndexer, namespace)} } // ReferenceGrantNamespaceLister helps list and get ReferenceGrants. @@ -74,26 +66,5 @@ type ReferenceGrantNamespaceLister interface { // referenceGrantNamespaceLister implements the ReferenceGrantNamespaceLister // interface. type referenceGrantNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all ReferenceGrants in the indexer for a given namespace. -func (s referenceGrantNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ReferenceGrant, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.ReferenceGrant)) - }) - return ret, err -} - -// Get retrieves the ReferenceGrant from the indexer for a given namespace and name. -func (s referenceGrantNamespaceLister) Get(name string) (*v1beta1.ReferenceGrant, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("referencegrant"), name) - } - return obj.(*v1beta1.ReferenceGrant), nil + listers.ResourceIndexer[*v1beta1.ReferenceGrant] } diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go index 6d182768d0..77ae251163 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go @@ -17,6 +17,8 @@ limitations under the License. package fieldpath import ( + "fmt" + "sigs.k8s.io/structured-merge-diff/v4/value" "sort" "strings" @@ -136,6 +138,198 @@ func (s *Set) EnsureNamedFieldsAreMembers(sc *schema.Schema, tr schema.TypeRef) } } +// MakePrefixMatcherOrDie is the same as PrefixMatcher except it panics if parts can't be +// turned into a SetMatcher. +func MakePrefixMatcherOrDie(parts ...interface{}) *SetMatcher { + result, err := PrefixMatcher(parts...) + if err != nil { + panic(err) + } + return result +} + +// PrefixMatcher creates a SetMatcher that matches all field paths prefixed by the given list of matcher path parts. +// The matcher parts may any of: +// +// - PathElementMatcher - for wildcards, `MatchAnyPathElement()` can be used as well. +// - PathElement - for any path element +// - value.FieldList - for listMap keys +// - value.Value - for scalar list elements +// - string - For field names +// - int - for array indices +func PrefixMatcher(parts ...interface{}) (*SetMatcher, error) { + current := MatchAnySet() // match all field path suffixes + for i := len(parts) - 1; i >= 0; i-- { + part := parts[i] + var pattern PathElementMatcher + switch t := part.(type) { + case PathElementMatcher: + // any path matcher, including wildcard + pattern = t + case PathElement: + // any path element + pattern = PathElementMatcher{PathElement: t} + case *value.FieldList: + // a listMap key + if len(*t) == 0 { + return nil, fmt.Errorf("associative list key type path elements must have at least one key (got zero)") + } + pattern = PathElementMatcher{PathElement: PathElement{Key: t}} + case value.Value: + // a scalar or set-type list element + pattern = PathElementMatcher{PathElement: PathElement{Value: &t}} + case string: + // a plain field name + pattern = PathElementMatcher{PathElement: PathElement{FieldName: &t}} + case int: + // a plain list index + pattern = PathElementMatcher{PathElement: PathElement{Index: &t}} + default: + return nil, fmt.Errorf("unexpected type %T", t) + } + current = &SetMatcher{ + members: []*SetMemberMatcher{{ + Path: pattern, + Child: current, + }}, + } + } + return current, nil +} + +// MatchAnyPathElement returns a PathElementMatcher that matches any path element. +func MatchAnyPathElement() PathElementMatcher { + return PathElementMatcher{Wildcard: true} +} + +// MatchAnySet returns a SetMatcher that matches any set. +func MatchAnySet() *SetMatcher { + return &SetMatcher{wildcard: true} +} + +// NewSetMatcher returns a new SetMatcher. +// Wildcard members take precedent over non-wildcard members; +// all non-wildcard members are ignored if there is a wildcard members. +func NewSetMatcher(wildcard bool, members ...*SetMemberMatcher) *SetMatcher { + sort.Sort(sortedMemberMatcher(members)) + return &SetMatcher{wildcard: wildcard, members: members} +} + +// SetMatcher defines a matcher that matches fields in a Set. +// SetMatcher is structured much like a Set but with wildcard support. +type SetMatcher struct { + // wildcard indicates that all members and children are included in the match. + // If set, the members field is ignored. + wildcard bool + // members provides patterns to match the members of a Set. + // Wildcard members are sorted before non-wildcards and take precedent over + // non-wildcard members. + members sortedMemberMatcher +} + +type sortedMemberMatcher []*SetMemberMatcher + +func (s sortedMemberMatcher) Len() int { return len(s) } +func (s sortedMemberMatcher) Less(i, j int) bool { return s[i].Path.Less(s[j].Path) } +func (s sortedMemberMatcher) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s sortedMemberMatcher) Find(p PathElementMatcher) (location int, ok bool) { + return sort.Find(len(s), func(i int) int { + return s[i].Path.Compare(p) + }) +} + +// Merge merges s and s2 and returns a SetMatcher that matches all field paths matched by either s or s2. +// During the merge, members of s and s2 with the same PathElementMatcher merged into a single member +// with the children of each merged by calling this function recursively. +func (s *SetMatcher) Merge(s2 *SetMatcher) *SetMatcher { + if s.wildcard || s2.wildcard { + return NewSetMatcher(true) + } + merged := make(sortedMemberMatcher, len(s.members), len(s.members)+len(s2.members)) + copy(merged, s.members) + for _, m := range s2.members { + if i, ok := s.members.Find(m.Path); ok { + // since merged is a shallow copy, do not modify elements in place + merged[i] = &SetMemberMatcher{ + Path: merged[i].Path, + Child: merged[i].Child.Merge(m.Child), + } + } else { + merged = append(merged, m) + } + } + return NewSetMatcher(false, merged...) // sort happens here +} + +// SetMemberMatcher defines a matcher that matches the members of a Set. +// SetMemberMatcher is structured much like the elements of a SetNodeMap, but +// with wildcard support. +type SetMemberMatcher struct { + // Path provides a matcher to match members of a Set. + // If Path is a wildcard, all members of a Set are included in the match. + // Otherwise, if any Path is Equal to a member of a Set, that member is + // included in the match and the children of that member are matched + // against the Child matcher. + Path PathElementMatcher + + // Child provides a matcher to use for the children of matched members of a Set. + Child *SetMatcher +} + +// PathElementMatcher defined a path matcher for a PathElement. +type PathElementMatcher struct { + // Wildcard indicates that all PathElements are matched by this matcher. + // If set, PathElement is ignored. + Wildcard bool + + // PathElement indicates that a PathElement is matched if it is Equal + // to this PathElement. + PathElement +} + +func (p PathElementMatcher) Equals(p2 PathElementMatcher) bool { + return p.Wildcard != p2.Wildcard && p.PathElement.Equals(p2.PathElement) +} + +func (p PathElementMatcher) Less(p2 PathElementMatcher) bool { + if p.Wildcard && !p2.Wildcard { + return true + } else if p2.Wildcard { + return false + } + return p.PathElement.Less(p2.PathElement) +} + +func (p PathElementMatcher) Compare(p2 PathElementMatcher) int { + if p.Wildcard && !p2.Wildcard { + return -1 + } else if p2.Wildcard { + return 1 + } + return p.PathElement.Compare(p2.PathElement) +} + +// FilterIncludeMatches returns a Set with only the field paths that match. +func (s *Set) FilterIncludeMatches(pattern *SetMatcher) *Set { + if pattern.wildcard { + return s + } + + members := PathElementSet{} + for _, m := range s.Members.members { + for _, pm := range pattern.members { + if pm.Path.Wildcard || pm.Path.PathElement.Equals(m) { + members.Insert(m) + break + } + } + } + return &Set{ + Members: members, + Children: *s.Children.FilterIncludeMatches(pattern), + } +} + // Size returns the number of members of the set. func (s *Set) Size() int { return s.Members.Size() + s.Children.Size() @@ -476,6 +670,33 @@ func (s *SetNodeMap) EnsureNamedFieldsAreMembers(sc *schema.Schema, tr schema.Ty } } +// FilterIncludeMatches returns a SetNodeMap with only the field paths that match the matcher. +func (s *SetNodeMap) FilterIncludeMatches(pattern *SetMatcher) *SetNodeMap { + if pattern.wildcard { + return s + } + + var out sortedSetNode + for _, member := range s.members { + for _, c := range pattern.members { + if c.Path.Wildcard || c.Path.PathElement.Equals(member.pathElement) { + childSet := member.set.FilterIncludeMatches(c.Child) + if childSet.Size() > 0 { + out = append(out, setNode{ + pathElement: member.pathElement, + set: childSet, + }) + } + break + } + } + } + + return &SetNodeMap{ + members: out, + } +} + // Iterate calls f for each PathElement in the set. func (s *SetNodeMap) Iterate(f func(PathElement)) { for _, n := range s.members { @@ -503,3 +724,59 @@ func (s *SetNodeMap) Leaves() *SetNodeMap { } return out } + +// Filter defines an interface for excluding field paths from a set. +// NewExcludeSetFilter can be used to create a filter that removes +// specific field paths and all of their children. +// NewIncludeMatcherFilter can be used to create a filter that removes all fields except +// the fields that match a field path matcher. PrefixMatcher and MakePrefixMatcherOrDie +// can be used to define field path patterns. +type Filter interface { + // Filter returns a filtered copy of the set. + Filter(*Set) *Set +} + +// NewExcludeSetFilter returns a filter that removes field paths in the exclude set. +func NewExcludeSetFilter(exclude *Set) Filter { + return excludeFilter{exclude} +} + +// NewExcludeFilterSetMap converts a map of APIVersion to exclude set to a map of APIVersion to exclude filters. +func NewExcludeFilterSetMap(resetFields map[APIVersion]*Set) map[APIVersion]Filter { + result := make(map[APIVersion]Filter) + for k, v := range resetFields { + result[k] = excludeFilter{v} + } + return result +} + +type excludeFilter struct { + excludeSet *Set +} + +func (t excludeFilter) Filter(set *Set) *Set { + return set.RecursiveDifference(t.excludeSet) +} + +// NewIncludeMatcherFilter returns a filter that only includes field paths that match. +// If no matchers are provided, the filter includes all field paths. +// PrefixMatcher and MakePrefixMatcherOrDie can help create basic matcher. +func NewIncludeMatcherFilter(matchers ...*SetMatcher) Filter { + if len(matchers) == 0 { + return includeMatcherFilter{&SetMatcher{wildcard: true}} + } + matcher := matchers[0] + for i := 1; i < len(matchers); i++ { + matcher = matcher.Merge(matchers[i]) + } + + return includeMatcherFilter{matcher} +} + +type includeMatcherFilter struct { + matcher *SetMatcher +} + +func (pf includeMatcherFilter) Filter(set *Set) *Set { + return set.FilterIncludeMatches(pf.matcher) +} diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go index d5a977d607..34ab2d6fb4 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go @@ -15,7 +15,6 @@ package merge import ( "fmt" - "sigs.k8s.io/structured-merge-diff/v4/fieldpath" "sigs.k8s.io/structured-merge-diff/v4/typed" "sigs.k8s.io/structured-merge-diff/v4/value" @@ -31,8 +30,8 @@ type Converter interface { // UpdateBuilder allows you to create a new Updater by exposing all of // the options and setting them once. type UpdaterBuilder struct { - Converter Converter - IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set + Converter Converter + IgnoreFilter map[fieldpath.APIVersion]fieldpath.Filter // Stop comparing the new object with old object after applying. // This was initially used to avoid spurious etcd update, but @@ -46,7 +45,7 @@ type UpdaterBuilder struct { func (u *UpdaterBuilder) BuildUpdater() *Updater { return &Updater{ Converter: u.Converter, - IgnoredFields: u.IgnoredFields, + IgnoreFilter: u.IgnoreFilter, returnInputOnNoop: u.ReturnInputOnNoop, } } @@ -58,7 +57,7 @@ type Updater struct { Converter Converter // Deprecated: This will eventually become private. - IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set + IgnoreFilter map[fieldpath.APIVersion]fieldpath.Filter returnInputOnNoop bool } @@ -72,7 +71,7 @@ func (s *Updater) update(oldObject, newObject *typed.TypedValue, version fieldpa } versions := map[fieldpath.APIVersion]*typed.Comparison{ - version: compare.ExcludeFields(s.IgnoredFields[version]), + version: compare.FilterFields(s.IgnoreFilter[version]), } for manager, managerSet := range managers { @@ -102,7 +101,7 @@ func (s *Updater) update(oldObject, newObject *typed.TypedValue, version fieldpa if err != nil { return nil, nil, fmt.Errorf("failed to compare objects: %v", err) } - versions[managerSet.APIVersion()] = compare.ExcludeFields(s.IgnoredFields[managerSet.APIVersion()]) + versions[managerSet.APIVersion()] = compare.FilterFields(s.IgnoreFilter[managerSet.APIVersion()]) } conflictSet := managerSet.Set().Intersection(compare.Modified.Union(compare.Added)) @@ -154,13 +153,14 @@ func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldp if _, ok := managers[manager]; !ok { managers[manager] = fieldpath.NewVersionedSet(fieldpath.NewSet(), version, false) } - - ignored := s.IgnoredFields[version] - if ignored == nil { - ignored = fieldpath.NewSet() + set := managers[manager].Set().Difference(compare.Removed).Union(compare.Modified).Union(compare.Added) + ignoreFilter := s.IgnoreFilter[version] + if ignoreFilter != nil { + set = ignoreFilter.Filter(set) } + managers[manager] = fieldpath.NewVersionedSet( - managers[manager].Set().Difference(compare.Removed).Union(compare.Modified).Union(compare.Added).RecursiveDifference(ignored), + set, version, false, ) @@ -189,13 +189,9 @@ func (s *Updater) Apply(liveObject, configObject *typed.TypedValue, version fiel return nil, fieldpath.ManagedFields{}, fmt.Errorf("failed to get field set: %v", err) } - ignored := s.IgnoredFields[version] - if ignored != nil { - set = set.RecursiveDifference(ignored) - // TODO: is this correct. If we don't remove from lastSet pruning might remove the fields? - if lastSet != nil { - lastSet.Set().RecursiveDifference(ignored) - } + ignoreFilter := s.IgnoreFilter[version] + if ignoreFilter != nil { + set = ignoreFilter.Filter(set) } managers[manager] = fieldpath.NewVersionedSet(set, version, true) newObject, err = s.prune(newObject, managers, manager, lastSet) diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go index ed483cbbc4..5fffa5e2cd 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go @@ -72,6 +72,16 @@ func (c *Comparison) ExcludeFields(fields *fieldpath.Set) *Comparison { return c } +func (c *Comparison) FilterFields(filter fieldpath.Filter) *Comparison { + if filter == nil { + return c + } + c.Removed = filter.Filter(c.Removed) + c.Modified = filter.Filter(c.Modified) + c.Added = filter.Filter(c.Added) + return c +} + type compareWalker struct { lhs value.Value rhs value.Value diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go index 4258ee5bab..0e9f7cc7e4 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go @@ -19,9 +19,9 @@ package typed import ( "fmt" - yaml "gopkg.in/yaml.v2" "sigs.k8s.io/structured-merge-diff/v4/schema" "sigs.k8s.io/structured-merge-diff/v4/value" + yaml "sigs.k8s.io/yaml/goyaml.v2" ) // YAMLObject is an object encoded in YAML. diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go index f0d58d42cb..88693b87e8 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go @@ -19,7 +19,9 @@ package value import ( "bytes" "encoding/json" + "errors" "fmt" + "io" "reflect" "sort" "sync" @@ -184,6 +186,11 @@ func (e TypeReflectCacheEntry) ToUnstructured(sv reflect.Value) (interface{}, er // This is based on https://github.com/kubernetes/kubernetes/blob/82c9e5c814eb7acc6cc0a090c057294d0667ad66/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go#L505 // and is intended to replace it. + // Check if the object is a nil pointer. + if sv.Kind() == reflect.Ptr && sv.IsNil() { + // We're done - we don't need to store anything. + return nil, nil + } // Check if the object has a custom string converter and use it if available, since it is much more efficient // than round tripping through json. if converter, ok := e.getUnstructuredConverter(sv); ok { @@ -191,11 +198,6 @@ func (e TypeReflectCacheEntry) ToUnstructured(sv reflect.Value) (interface{}, er } // Check if the object has a custom JSON marshaller/unmarshaller. if marshaler, ok := e.getJsonMarshaler(sv); ok { - if sv.Kind() == reflect.Ptr && sv.IsNil() { - // We're done - we don't need to store anything. - return nil, nil - } - data, err := marshaler.MarshalJSON() if err != nil { return nil, err @@ -379,34 +381,47 @@ const maxDepth = 10000 // unmarshal unmarshals the given data // If v is a *map[string]interface{}, numbers are converted to int64 or float64 func unmarshal(data []byte, v interface{}) error { + // Build a decoder from the given data + decoder := json.NewDecoder(bytes.NewBuffer(data)) + // Preserve numbers, rather than casting to float64 automatically + decoder.UseNumber() + // Run the decode + if err := decoder.Decode(v); err != nil { + return err + } + next := decoder.InputOffset() + if _, err := decoder.Token(); !errors.Is(err, io.EOF) { + tail := bytes.TrimLeft(data[next:], " \t\r\n") + return fmt.Errorf("unexpected trailing data at offset %d", len(data)-len(tail)) + } + + // If the decode succeeds, post-process the object to convert json.Number objects to int64 or float64 switch v := v.(type) { case *map[string]interface{}: - // Build a decoder from the given data - decoder := json.NewDecoder(bytes.NewBuffer(data)) - // Preserve numbers, rather than casting to float64 automatically - decoder.UseNumber() - // Run the decode - if err := decoder.Decode(v); err != nil { - return err - } - // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 return convertMapNumbers(*v, 0) case *[]interface{}: - // Build a decoder from the given data - decoder := json.NewDecoder(bytes.NewBuffer(data)) - // Preserve numbers, rather than casting to float64 automatically - decoder.UseNumber() - // Run the decode - if err := decoder.Decode(v); err != nil { - return err - } - // If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64 return convertSliceNumbers(*v, 0) + case *interface{}: + return convertInterfaceNumbers(v, 0) + default: - return json.Unmarshal(data, v) + return nil + } +} + +func convertInterfaceNumbers(v *interface{}, depth int) error { + var err error + switch v2 := (*v).(type) { + case json.Number: + *v, err = convertNumber(v2) + case map[string]interface{}: + err = convertMapNumbers(v2, depth+1) + case []interface{}: + err = convertSliceNumbers(v2, depth+1) } + return err } // convertMapNumbers traverses the map, converting any json.Number values to int64 or float64. diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go index ea79e3a000..f72e5cd25e 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go @@ -23,7 +23,7 @@ import ( "strings" jsoniter "github.com/json-iterator/go" - "gopkg.in/yaml.v2" + yaml "sigs.k8s.io/yaml/goyaml.v2" ) var (